Get Started [BETA]
Essentials [BETA]
Payments Core APIs [BETA]
- Payments
- Payment Methods
- Payment Method Session
- Customers
- Refunds
Account management APIs [BETA]
- Organization
- Merchant Account
- Profile
- Connector Account
- API Key
- Routing
Other APIs [BETA]
- Proxy
- Tokenization
Payments
Payments - Create and Confirm Intent
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.
POST
/
v2
/
payments
Copy
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"
}'
Copy
{
"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"
}
}
}
],
"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
}
Authorizations
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.
Headers
Profile ID associated to the payment intent
Body
application/json
Response
200
application/json
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?
Copy
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"
}'
Copy
{
"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"
}
}
}
],
"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
}
Assistant
Responses are generated using AI and may contain mistakes.