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
- Revenue Recovery
Payment Methods
Payment Method - Create
Creates and stores a payment method against a customer. In case of cards, this API should be used only by PCI compliant merchants.
POST
/
v2
/
payment-methods
Payment Method - Create
Copy
Ask AI
curl --request POST \
--url https://sandbox.hyperswitch.io/v2/payment-methods \
--header 'Content-Type: application/json' \
--header 'api-key: <api-key>' \
--data '{
"payment_method_type": "card",
"payment_method_subtype": "ach",
"metadata": {},
"customer_id": "12345_cus_01926c58bc6e77c09e809964e72af8c8",
"payment_method_data": {
"card": {
"card_number": "4111111145551142",
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "John Doe",
"nick_name": "John Doe",
"card_issuing_country": "AF",
"card_network": "Visa",
"card_issuer": "<string>",
"card_type": "credit",
"card_cvc": "242"
}
},
"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>"
},
"psp_tokenization": {
"tokenization_type": "single_use",
"connector_id": "<string>"
},
"network_tokenization": {
"enable": "Enable"
}
}'
Copy
Ask AI
{
"id": "12345_pm_01926c58bc6e77c09e809964e72af8c8",
"merchant_id": "merchant_1671528864",
"customer_id": "12345_cus_01926c58bc6e77c09e809964e72af8c8",
"payment_method_type": "card",
"payment_method_subtype": "ach",
"recurring_enabled": true,
"created": "2023-01-18T11:04:09.922Z",
"last_used_at": "2024-02-24T11:04:09.922Z",
"payment_method_data": {
"card": {
"issuer_country": "AF",
"last4_digits": "<string>",
"expiry_month": "<string>",
"expiry_year": "<string>",
"card_holder_name": "<string>",
"card_fingerprint": "<string>",
"nick_name": "<string>",
"card_network": "Visa",
"card_isin": "<string>",
"card_issuer": "<string>",
"card_type": "<string>",
"saved_to_locker": true
}
},
"connector_tokens": [
{
"token": "pm_9UhMqBMEOooRIvJFFdeW",
"connector_token_request_reference_id": "<string>"
}
],
"network_token": {
"payment_method_data": {
"last4_digits": "<string>",
"issuer_country": "AF",
"network_token_expiry_month": "<string>",
"network_token_expiry_year": "<string>",
"nick_name": "<string>",
"card_holder_name": "<string>",
"card_isin": "<string>",
"card_issuer": "<string>",
"card_network": "Visa",
"card_type": "<string>",
"saved_to_locker": 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.
Body
application/json
Response
200
application/json
Payment Method Created
The response is of type object
.
Was this page helpful?
Payment Method - Create
Copy
Ask AI
curl --request POST \
--url https://sandbox.hyperswitch.io/v2/payment-methods \
--header 'Content-Type: application/json' \
--header 'api-key: <api-key>' \
--data '{
"payment_method_type": "card",
"payment_method_subtype": "ach",
"metadata": {},
"customer_id": "12345_cus_01926c58bc6e77c09e809964e72af8c8",
"payment_method_data": {
"card": {
"card_number": "4111111145551142",
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "John Doe",
"nick_name": "John Doe",
"card_issuing_country": "AF",
"card_network": "Visa",
"card_issuer": "<string>",
"card_type": "credit",
"card_cvc": "242"
}
},
"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>"
},
"psp_tokenization": {
"tokenization_type": "single_use",
"connector_id": "<string>"
},
"network_tokenization": {
"enable": "Enable"
}
}'
Copy
Ask AI
{
"id": "12345_pm_01926c58bc6e77c09e809964e72af8c8",
"merchant_id": "merchant_1671528864",
"customer_id": "12345_cus_01926c58bc6e77c09e809964e72af8c8",
"payment_method_type": "card",
"payment_method_subtype": "ach",
"recurring_enabled": true,
"created": "2023-01-18T11:04:09.922Z",
"last_used_at": "2024-02-24T11:04:09.922Z",
"payment_method_data": {
"card": {
"issuer_country": "AF",
"last4_digits": "<string>",
"expiry_month": "<string>",
"expiry_year": "<string>",
"card_holder_name": "<string>",
"card_fingerprint": "<string>",
"nick_name": "<string>",
"card_network": "Visa",
"card_isin": "<string>",
"card_issuer": "<string>",
"card_type": "<string>",
"saved_to_locker": true
}
},
"connector_tokens": [
{
"token": "pm_9UhMqBMEOooRIvJFFdeW",
"connector_token_request_reference_id": "<string>"
}
],
"network_token": {
"payment_method_data": {
"last4_digits": "<string>",
"issuer_country": "AF",
"network_token_expiry_month": "<string>",
"network_token_expiry_year": "<string>",
"nick_name": "<string>",
"card_holder_name": "<string>",
"card_isin": "<string>",
"card_issuer": "<string>",
"card_network": "Visa",
"card_type": "<string>",
"saved_to_locker": true
}
}
}
Assistant
Responses are generated using AI and may contain mistakes.