Skip to main content

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

The approvelyId is crucial for linking the card payment with the money transfer. Include it in the attribute array:
This allows you to:
  • Track which card payment funded which transfer
  • Reconcile transactions across both systems
  • Handle refunds if transfers fail
  • Generate accurate financial reports

Error Handling

Action: Return error to customer, don’t proceed with transfer
Action: Refund the card charge, inform customer
Action: Refund the card charge, return error
Action: Refund the card charge, log for investigation

API References

Payin API

Learn about card tokenization and charging

Payout API

Learn about money transfers and KYC verification

Charge Endpoint

Process card payments

Transfer Endpoint

Execute money transfers