# Create Payment - using a credit card nonce

TIP

Before creating a payment you need to generate a card nonce from the Client SDK (aka Frames), it will generate a card nonce that you can use on your server to create a payment. More details can be found here

# Using a credit card nonce

    Request example
    • Shell
    • JavaScript
    curl -X POST \
      https://api.ompay.com/v1/merchants/w3z8dfhkzvfq0j9n/payment \
      -H 'authorization: Basic ODZidWQ0Y2JremlxOXZmYzoweHI1ZDkwOHo2bmo4a2h6' \
      -H 'content-type: application/json' \
      -d '{
    		"intent": "sale",
    		"payer": {
    			"payment_type": "CC",
    			"funding_instrument": {
    				"credit_card_nonce": {
    					"nonce": "9bc34749-a3cf-4f08-bf84-c817238f93df",
    					"name": "John Smith"
    				}
    			},
    			"payer_info": {
    				"email": "tomhank@gmail.com",
    				"name": "Tom Hanks",
    				"billing_address": {
    					"line1": "18 Avenue",
    					"line2": "cassidy",
    					"city": "Rose-Hill",
    					"country_code": "mu",
    					"postal_code": "72101",
    					"state": "",
    					"phone": {
    						"country_code": "230",
    						"number": "57976041"
    					}
    				}
    			},
    			"browser_info": {
    				"accept_header": "text/html,application/xhtml+xml,application/xml;q\u003d0.9,image/avif,image/webp,*/*;q\u003d0.8",
    				"color_depth": 24,
    				"java_enabled": false,
    				"javascript_enabled": true,
    				"language": "en-US",
    				"screen_height": "1080",
    				"screen_width": "1920",
    				"timezone_offset": -240,
    				"user_agent": "Mozilla/5.0 \u0026 #40;Windows NT 10.0; Win64; x64; rv:103.0\u0026#41; Gecko/20100101 Firefox/103.0",
    				"ip": "12.2.12.0",
    				"channel": "Web"
    			}
    		},
    		"payee": {
    			"email": "mail@test.com",
    			"merchant_id": "w3z8dfhkzvfq0j9n"
    		},
    		"transaction": {
    			"type": "1",
    			"amount": {
    				"currency": "USD",
    				"total": "300"
    			},
    			"invoice_number": "123455",
    			"items": [{
    					"sku": "100299S",
    					"name": "Ultrawatch",
    					"description": "Smart watch",
    					"quantity": "1",
    					"price": "500",
    					"shipping": "20",
    					"currency": "USD",
    					"url": "",
    					"image": "",
    					"tangible": "true"
    				},
    				{
    					"sku": "100269S",
    					"name": "Drone",
    					"description": "drone x",
    					"quantity": "1",
    					"price": "500",
    					"shipping": "20",
    					"currency": "USD",
    					"url": "",
    					"image": "",
    					"tangible": "true"
    				}
    			]
    		}
    	}'
    
    Response example
    	{
    		"id": "NXWD2R715Z24XB1V80JZ",
    		"reference_id": "NXWD2R715Z24XB1V80JZ",
    		"state": "pending",
            "result": {
                "authorisation_code": "00000",
                "redirect_url": "https://api.sandbox.ompay.com/v1/redirect/06a7fbfcacad4290b854597dc442138f",
                "authenticate_url": "https://api.sandbox.ompay.com/v1/authenticate/06a7fbfcacad4290b854597dc442138f",
                "code": "1007",
                "description": "Redirect"
            },
            "intent": "SALE",
    		"payer": {
    			"payment_type": "CC",
    			"funding_instrument": {
    				"credit_card": {
    					"id": "20abc6eb-35fd-427e-b57e-c7eea99dd423",
    					"type": "Visa",
    					"expire_month": 6,
    					"expire_year": 2025,
    					"name": "John Smith",
    					"cvv_check": "Y",
    					"avs_check": "S",
    					"last4": "9996",
    					"bin": "454347",
    					"bin_data": {
    						"bin": "454347",
    						"country_code": "MU",
    						"country_name": "Mauritius",
    						"bank_name": "MCB",
    						"card_scheme": "Visa",
    						"card_type": "Credit",
    						"card_category": "1"
    					}
    				}
    			},
    			"payer_info": {
    				"id": "35d4d1ec-4f9d-416d-acdc-d12f4bf0c6df",
    				"email": "tomhank@gmail.com",
    				"name": "Tom Hanks",
    				"billing_address": {
    					"phone": {
    						"country_code": "230",
    						"number": "57976041"
    					},
    					"line1": "18 Avenue",
    					"line2": "cassidy",
    					"city": "Rose-Hill",
    					"country_code": "MU",
    					"postal_code": "72101",
    					"state": ""
    				}
    			}
    		},
    		"transaction": {
    			"amount": {
    				"currency": "USD",
    				"total": "300"
    			},
    			"type": "1",
    			"mode": "1",
    			"items": [
    				{
    					"sku": "100299S",
    					"name": "Ultrawatch",
    					"description": "Smart watch",
    					"quantity": "1",
    					"price": "500",
    					"shipping": "",
    					"url": ""
    				},
    				{
    					"sku": "100269S",
    					"name": "Drone",
    					"description": "drone x",
    					"quantity": "1",
    					"price": "500",
    					"shipping": "",
    					"url": ""
    				}
    			],
    			"shipping_address": {
    				"phone": {}
    			},
    			"invoice_number": "123455"
    		},
    		"custom": {},
    		"risk_check": true,
    		"three_d": {},
    		"create_time": "2023-06-10T17:59:47Z",
    		"subscriptions": null
    	}
    

    TIP

    1. Please ensure that when processing Omannet transactions, the intent is set to sale.
    2. In case the response includes a redirect_url, kindly redirect your customers to that URL to complete the OTP flow.

    # Request

    To proceed with a sale or authorized payment for future capture, you will need to include the payment details within the JSON request body. Depending on your specific requirements, set the intent parameter to either "sale" or "auth".

    It is also essential to provide the necessary "payer" and "transaction" details.

    The type of payment that will be created is determined by the specific combination of the "payment_method" and "funding_instrument" parameters.

    # Header parameters

    The request require a Basic authentication in the header. For more information about HTTP request headers, see HTTP request headers.