curl --request POST \
--url https://sandbox.hyperswitch.io/v2/payments \
--header 'Content-Type: application/json' \
--header 'X-Profile-Id: <x-profile-id>' \
--header 'api-key: <api-key>' \
--data '{
"amount_details": {
"currency": "USD",
"order_amount": 6540
},
"payment_method_data": {
"card": {
"card_cvc": "123",
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
"card_number": "4242424242424242"
}
},
"payment_method_subtype": "credit",
"payment_method_type": "card"
}'
{
"id": "12345_pay_01926c58bc6e77c09e809964e72af8c8",
"status": "succeeded",
"amount": {
"order_amount": 6540,
"currency": "AED",
"shipping_cost": 123,
"order_tax_amount": 123,
"external_tax_calculation": "skip",
"surcharge_calculation": "skip",
"surcharge_amount": 123,
"tax_on_surcharge": 123,
"net_amount": 123,
"amount_to_capture": 123,
"amount_capturable": 123,
"amount_captured": 123
},
"customer_id": "12345_cus_01926c58bc6e77c09e809964e72af8c8",
"connector": "stripe",
"created": "2022-09-10T10:11:12Z",
"payment_method_data": {
"card": {
"last4": "<string>",
"card_type": "<string>",
"card_network": "Visa",
"card_issuer": "<string>",
"card_issuing_country": "<string>",
"card_isin": "<string>",
"card_extended_bin": "<string>",
"card_exp_month": "<string>",
"card_exp_year": "<string>",
"card_holder_name": "<string>",
"payment_checks": "<any>",
"authentication_data": "<any>"
},
"billing": {
"address": {
"city": "New York",
"country": "AF",
"line1": "123, King Street",
"line2": "Powelson Avenue",
"line3": "Bridgewater",
"zip": "08807",
"state": "New York",
"first_name": "John",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": "+1"
},
"email": "<string>"
}
},
"payment_method_type": "card",
"payment_method_subtype": "ach",
"connector_transaction_id": "993672945374576J",
"connector_reference_id": "993672945374576J",
"merchant_connector_id": "<string>",
"browser_info": {
"color_depth": 1,
"java_enabled": true,
"java_script_enabled": true,
"language": "<string>",
"screen_height": 1,
"screen_width": 1,
"time_zone": 123,
"ip_address": "<string>",
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"user_agent": "<string>",
"os_type": "<string>",
"os_version": "<string>",
"device_model": "<string>",
"accept_language": "<string>"
},
"error": {
"code": "<string>",
"message": "<string>",
"unified_code": "<string>",
"unified_message": "<string>",
"network_advice_code": "<string>",
"network_decline_code": "<string>",
"network_error_message": "<string>"
},
"shipping": {
"address": {
"city": "New York",
"country": "AF",
"line1": "123, King Street",
"line2": "Powelson Avenue",
"line3": "Bridgewater",
"zip": "08807",
"state": "New York",
"first_name": "John",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": "+1"
},
"email": "<string>"
},
"billing": {
"address": {
"city": "New York",
"country": "AF",
"line1": "123, King Street",
"line2": "Powelson Avenue",
"line3": "Bridgewater",
"zip": "08807",
"state": "New York",
"first_name": "John",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": "+1"
},
"email": "<string>"
},
"attempts": [
{
"id": "<string>",
"status": "started",
"amount": {
"net_amount": 123,
"amount_to_capture": 123,
"surcharge_amount": 123,
"tax_on_surcharge": 123,
"amount_capturable": 123,
"shipping_cost": 123,
"order_tax_amount": 123
},
"connector": "stripe",
"error": {
"code": "<string>",
"message": "<string>",
"unified_code": "<string>",
"unified_message": "<string>",
"network_advice_code": "<string>",
"network_decline_code": "<string>",
"network_error_message": "<string>"
},
"authentication_type": "three_ds",
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z",
"cancellation_reason": "<string>",
"payment_token": "187282ab-40ef-47a9-9206-5099ba31e432",
"connector_metadata": {
"apple_pay": {
"session_token_data": {
"payment_processing_certificate": "<string>",
"payment_processing_certificate_key": "<string>",
"payment_processing_details_at": "Hyperswitch",
"certificate": "<string>",
"certificate_keys": "<string>",
"merchant_identifier": "<string>",
"display_name": "<string>",
"initiative": "web",
"initiative_context": "<string>",
"merchant_business_country": "AF"
}
},
"airwallex": {
"payload": "<string>"
},
"noon": {
"order_category": "<string>"
},
"braintree": {
"merchant_account_id": "<string>",
"merchant_config_currency": "<string>"
},
"adyen": {
"testing": {
"holder_name": "<string>"
}
}
},
"payment_experience": "redirect_to_url",
"payment_method_type": "card",
"connector_reference_id": "993672945374576J",
"payment_method_subtype": "ach",
"connector_payment_id": "<string>",
"payment_method_id": "12345_pm_01926c58bc6e77c09e809964e72af8c8",
"client_source": "<string>",
"client_version": "<string>",
"feature_metadata": {
"revenue_recovery": {
"attempt_triggered_by": "internal",
"charge_id": "ch_123abc456def789ghi012klmn"
}
},
"payment_method_data": {
"card": {
"last4": "<string>",
"card_type": "<string>",
"card_network": "Visa",
"card_issuer": "<string>",
"card_issuing_country": "<string>",
"card_isin": "<string>",
"card_extended_bin": "<string>",
"card_exp_month": "<string>",
"card_exp_year": "<string>",
"card_holder_name": "<string>",
"payment_checks": "<any>",
"authentication_data": "<any>"
},
"billing": {
"address": {
"city": "New York",
"country": "AF",
"line1": "123, King Street",
"line2": "Powelson Avenue",
"line3": "Bridgewater",
"zip": "08807",
"state": "New York",
"first_name": "John",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": "+1"
},
"email": "<string>"
}
}
}
],
"connector_token_details": {
"token": "pm_9UhMqBMEOooRIvJFFdeW",
"connector_token_request_reference_id": "<string>"
},
"payment_method_id": "<string>",
"next_action": {
"redirect_to_url": "<string>",
"type": "redirect_to_url"
},
"return_url": "<string>",
"authentication_type": "three_ds",
"authentication_type_applied": "three_ds",
"is_iframe_redirection_enabled": true,
"merchant_reference_id": "pay_mbabizu24mvu3mela5njyhpit4",
"raw_connector_response": "<string>",
"feature_metadata": {
"redirect_response": {
"param": "<string>",
"json_payload": {}
},
"search_tags": [
"<string>"
],
"apple_pay_recurring_details": {
"payment_description": "<string>",
"regular_billing": {
"label": "<string>",
"recurring_payment_start_date": "2023-09-10T23:59:59Z",
"recurring_payment_end_date": "2023-09-10T23:59:59Z",
"recurring_payment_interval_unit": "year",
"recurring_payment_interval_count": 123
},
"billing_agreement": "<string>",
"management_url": "https://hyperswitch.io"
},
"revenue_recovery": {
"total_retry_count": "1",
"payment_connector_transmission": "ConnectorCallUnsuccessful",
"billing_connector_id": "mca_1234567890",
"active_attempt_payment_connector_id": "mca_1234567890",
"billing_connector_payment_details": {
"payment_processor_token": "<string>",
"connector_customer_id": "<string>"
},
"payment_method_type": "card",
"payment_method_subtype": "ach",
"connector": "authipay",
"billing_connector_payment_method_details": {
"type": "card",
"value": {
"card_network": "Visa",
"card_issuer": "JP MORGAN CHASE"
}
},
"invoice_next_billing_time": "2023-11-07T05:31:56Z",
"invoice_billing_started_at_time": "2023-11-07T05:31:56Z",
"first_payment_attempt_pg_error_code": "card_declined",
"first_payment_attempt_network_decline_code": "05",
"first_payment_attempt_network_advice_code": "02"
}
}
}
Creates and confirms a payment intent object when the amount and payment method information are passed.
You will require the ‘API - Key’ from the Hyperswitch dashboard to make the call.
curl --request POST \
--url https://sandbox.hyperswitch.io/v2/payments \
--header 'Content-Type: application/json' \
--header 'X-Profile-Id: <x-profile-id>' \
--header 'api-key: <api-key>' \
--data '{
"amount_details": {
"currency": "USD",
"order_amount": 6540
},
"payment_method_data": {
"card": {
"card_cvc": "123",
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
"card_number": "4242424242424242"
}
},
"payment_method_subtype": "credit",
"payment_method_type": "card"
}'
{
"id": "12345_pay_01926c58bc6e77c09e809964e72af8c8",
"status": "succeeded",
"amount": {
"order_amount": 6540,
"currency": "AED",
"shipping_cost": 123,
"order_tax_amount": 123,
"external_tax_calculation": "skip",
"surcharge_calculation": "skip",
"surcharge_amount": 123,
"tax_on_surcharge": 123,
"net_amount": 123,
"amount_to_capture": 123,
"amount_capturable": 123,
"amount_captured": 123
},
"customer_id": "12345_cus_01926c58bc6e77c09e809964e72af8c8",
"connector": "stripe",
"created": "2022-09-10T10:11:12Z",
"payment_method_data": {
"card": {
"last4": "<string>",
"card_type": "<string>",
"card_network": "Visa",
"card_issuer": "<string>",
"card_issuing_country": "<string>",
"card_isin": "<string>",
"card_extended_bin": "<string>",
"card_exp_month": "<string>",
"card_exp_year": "<string>",
"card_holder_name": "<string>",
"payment_checks": "<any>",
"authentication_data": "<any>"
},
"billing": {
"address": {
"city": "New York",
"country": "AF",
"line1": "123, King Street",
"line2": "Powelson Avenue",
"line3": "Bridgewater",
"zip": "08807",
"state": "New York",
"first_name": "John",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": "+1"
},
"email": "<string>"
}
},
"payment_method_type": "card",
"payment_method_subtype": "ach",
"connector_transaction_id": "993672945374576J",
"connector_reference_id": "993672945374576J",
"merchant_connector_id": "<string>",
"browser_info": {
"color_depth": 1,
"java_enabled": true,
"java_script_enabled": true,
"language": "<string>",
"screen_height": 1,
"screen_width": 1,
"time_zone": 123,
"ip_address": "<string>",
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"user_agent": "<string>",
"os_type": "<string>",
"os_version": "<string>",
"device_model": "<string>",
"accept_language": "<string>"
},
"error": {
"code": "<string>",
"message": "<string>",
"unified_code": "<string>",
"unified_message": "<string>",
"network_advice_code": "<string>",
"network_decline_code": "<string>",
"network_error_message": "<string>"
},
"shipping": {
"address": {
"city": "New York",
"country": "AF",
"line1": "123, King Street",
"line2": "Powelson Avenue",
"line3": "Bridgewater",
"zip": "08807",
"state": "New York",
"first_name": "John",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": "+1"
},
"email": "<string>"
},
"billing": {
"address": {
"city": "New York",
"country": "AF",
"line1": "123, King Street",
"line2": "Powelson Avenue",
"line3": "Bridgewater",
"zip": "08807",
"state": "New York",
"first_name": "John",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": "+1"
},
"email": "<string>"
},
"attempts": [
{
"id": "<string>",
"status": "started",
"amount": {
"net_amount": 123,
"amount_to_capture": 123,
"surcharge_amount": 123,
"tax_on_surcharge": 123,
"amount_capturable": 123,
"shipping_cost": 123,
"order_tax_amount": 123
},
"connector": "stripe",
"error": {
"code": "<string>",
"message": "<string>",
"unified_code": "<string>",
"unified_message": "<string>",
"network_advice_code": "<string>",
"network_decline_code": "<string>",
"network_error_message": "<string>"
},
"authentication_type": "three_ds",
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z",
"cancellation_reason": "<string>",
"payment_token": "187282ab-40ef-47a9-9206-5099ba31e432",
"connector_metadata": {
"apple_pay": {
"session_token_data": {
"payment_processing_certificate": "<string>",
"payment_processing_certificate_key": "<string>",
"payment_processing_details_at": "Hyperswitch",
"certificate": "<string>",
"certificate_keys": "<string>",
"merchant_identifier": "<string>",
"display_name": "<string>",
"initiative": "web",
"initiative_context": "<string>",
"merchant_business_country": "AF"
}
},
"airwallex": {
"payload": "<string>"
},
"noon": {
"order_category": "<string>"
},
"braintree": {
"merchant_account_id": "<string>",
"merchant_config_currency": "<string>"
},
"adyen": {
"testing": {
"holder_name": "<string>"
}
}
},
"payment_experience": "redirect_to_url",
"payment_method_type": "card",
"connector_reference_id": "993672945374576J",
"payment_method_subtype": "ach",
"connector_payment_id": "<string>",
"payment_method_id": "12345_pm_01926c58bc6e77c09e809964e72af8c8",
"client_source": "<string>",
"client_version": "<string>",
"feature_metadata": {
"revenue_recovery": {
"attempt_triggered_by": "internal",
"charge_id": "ch_123abc456def789ghi012klmn"
}
},
"payment_method_data": {
"card": {
"last4": "<string>",
"card_type": "<string>",
"card_network": "Visa",
"card_issuer": "<string>",
"card_issuing_country": "<string>",
"card_isin": "<string>",
"card_extended_bin": "<string>",
"card_exp_month": "<string>",
"card_exp_year": "<string>",
"card_holder_name": "<string>",
"payment_checks": "<any>",
"authentication_data": "<any>"
},
"billing": {
"address": {
"city": "New York",
"country": "AF",
"line1": "123, King Street",
"line2": "Powelson Avenue",
"line3": "Bridgewater",
"zip": "08807",
"state": "New York",
"first_name": "John",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": "+1"
},
"email": "<string>"
}
}
}
],
"connector_token_details": {
"token": "pm_9UhMqBMEOooRIvJFFdeW",
"connector_token_request_reference_id": "<string>"
},
"payment_method_id": "<string>",
"next_action": {
"redirect_to_url": "<string>",
"type": "redirect_to_url"
},
"return_url": "<string>",
"authentication_type": "three_ds",
"authentication_type_applied": "three_ds",
"is_iframe_redirection_enabled": true,
"merchant_reference_id": "pay_mbabizu24mvu3mela5njyhpit4",
"raw_connector_response": "<string>",
"feature_metadata": {
"redirect_response": {
"param": "<string>",
"json_payload": {}
},
"search_tags": [
"<string>"
],
"apple_pay_recurring_details": {
"payment_description": "<string>",
"regular_billing": {
"label": "<string>",
"recurring_payment_start_date": "2023-09-10T23:59:59Z",
"recurring_payment_end_date": "2023-09-10T23:59:59Z",
"recurring_payment_interval_unit": "year",
"recurring_payment_interval_count": 123
},
"billing_agreement": "<string>",
"management_url": "https://hyperswitch.io"
},
"revenue_recovery": {
"total_retry_count": "1",
"payment_connector_transmission": "ConnectorCallUnsuccessful",
"billing_connector_id": "mca_1234567890",
"active_attempt_payment_connector_id": "mca_1234567890",
"billing_connector_payment_details": {
"payment_processor_token": "<string>",
"connector_customer_id": "<string>"
},
"payment_method_type": "card",
"payment_method_subtype": "ach",
"connector": "authipay",
"billing_connector_payment_method_details": {
"type": "card",
"value": {
"card_network": "Visa",
"card_issuer": "JP MORGAN CHASE"
}
},
"invoice_next_billing_time": "2023-11-07T05:31:56Z",
"invoice_billing_started_at_time": "2023-11-07T05:31:56Z",
"first_payment_attempt_pg_error_code": "card_declined",
"first_payment_attempt_network_decline_code": "05",
"first_payment_attempt_network_advice_code": "02"
}
}
}
Use the API key created under your merchant account from the HyperSwitch dashboard. API key is used to authenticate API requests from your merchant server only. Don't expose this key on a website or embed it in a mobile application.
Profile ID associated to the payment intent
Payment created
Response for Payment Intent Confirm Few fields should be expandable, we need not return these in the normal response But when explicitly requested for expanded objects, these can be returned For example shipping, billing, customer, payment_method
Was this page helpful?