Payment method details of users are stored in a secure PCI-compliant locker, for processing payouts in future. These stored payment method details can be listed for a given customer, which returns a payment_token
for processing payouts.
There are two entry points to storing payment methods for a given customer.
- Persisting payment methods prior to processing transactions
- Payment methods can be created for a given customer using
/payment_methods
API. - This basically stores the passed payment method details in secure PCI-compliant locker.
- Payment methods can be created for a given customer using
- Persisting payment methods post a successful transaction
- If a payment request was created with
"setup_future_usage": "off_session"
or if a payout request was created with"recurring": true
, the payment method details will be stored in the secure locker once the transaction completes with a successful status.
- If a payment request was created with
Once the payment methods are stored in locker, they can be fetched using customer's list payment method API. This basically returns the identifiers for the saved payment methods along with a payment_token
which can be used for processing transactions for a customer.
Payouts can be created and processed using the payment_token
for a given customer.
We will be using HyperSwitch's hosted dashboard and Postman API collection and will be working only with the payout transactions for this bit. You can find API reference here.
Backend API endpoint - https://sandbox.hyperswitch.io
Dashboard - https://app.hyperswitch.io
- Make sure processors are configured for processing payout transactions.
- Generate an API key by navigating to Developers section.
- Note down your
merchant_id
from the dashboard's home page.
Step 1 - Import Postman collection from here.
Import Postman collection
Step 2 - Navigate to collection's Variables tab to set up below variables
baseUrl
merchant_id
api_key
Updating env variables in Postman collection
Step 3 - Navigate to UseCase #1 section in the collection and execute in order.
Step 4 - Navigate to UseCase #2 section in the collection and execute in order.