Overview
This guide explains the complete transaction flow for accepting payments via card (Payin API) and delivering funds to recipients (Payout API). This integrated flow allows you to accept payments from customers and automatically transfer funds to recipients.Complete Transaction Flow
Step-by-Step Process
Phase 1: Card Payment (Payin)
1
Customer enters card details
Customer fills out the payment form on your website with their card information
Card data is entered directly into Approvely’s secure iframe, never touching your servers.
2
Tokenize card data
Your frontend calls Approvely’s tokenization API to convert card data into a secure nonce token
Nonce token received (e.g.,
nonce-pft4uav4cker5g8bk3db)3
Submit payment to backend
Frontend sends the nonce token to your backend server along with payment details
4
Charge the card
Your backend calls Approvely’s charge endpoint with the nonce token
Payment approved and
approvelyId received (e.g., txn_1234567890)Phase 2: Fund Transfer (Payout)
1
Verify recipient KYC
Check if the recipient is KYC verified and can receive the transfer amount
Recipient KYC verified and can receive the amount
2
Check transfer
Validate the transfer details before executing
The
approvelyId is included in the attribute array with name 'approvelyId' to link the payout with the payin transaction.3
Execute transfer
Execute the money transfer to the recipient
Transfer initiated successfully
4
Monitor transfer status
Poll the transfer status until completion
Funds successfully delivered to recipient
Linking Transactions
TheapprovelyId is crucial for linking the card payment with the money transfer. Include it in the attribute array:
- Track which card payment funded which transfer
- Reconcile transactions across both systems
- Handle refunds if transfers fail
- Generate accurate financial reports
Error Handling
Card charge fails
Card charge fails
Action: Return error to customer, don’t proceed with transfer
Recipient KYC limit exceeded
Recipient KYC limit exceeded
Action: Refund the card charge, inform customer
Transfer validation fails
Transfer validation fails
Action: Refund the card charge, return error
Transfer execution fails
Transfer execution fails
Action: Refund the card charge, log for investigation
