P2P Transfers: Request examples
Peer-to-Peer (P2P) transfers allow sending funds directly from one cardholder to another. This guide explains how to create a P2P transaction (PCI DSS scenario where you collect the sender’s card details) and how to check or receive callbacks about the transaction status.
Overview
- Creating a P2P transaction (PCI DSS merchants)
- Receiving a callback or retrieving the P2P transaction status
sequenceDiagram
title P2P Transfers
participant Merchant
participant PG as Payment Gateway
note over Merchant,PG: Step 1 - Create a P2P Transaction
Merchant->>PG: Create P2P transaction (PCI DSS)
activate PG
PG->>Merchant: Return P2P transaction info
deactivate PG
note over Merchant,PG: Once initiated, the transaction status can be polled or updated via callback
note over Merchant,PG: Step 2 - Callback or Check P2P Transaction Status
PG->>Merchant: Callback or status endpoint with updated status (p2pStatus)
opt Retrieve Detailed Info
Merchant->>PG: Retrieve P2P transaction details
PG->>Merchant: Return masked card data, cost, etc.
end
1. Create a P2P Transaction
If you are a PCI DSS merchant who collects the card data directly, you can initiate a P2P transfer by specifying both the sender’s and recipient’s card details, along with the transaction amount and currency.
- Request (PCI DSS)
curl -L 'https://gateway.madfintech.com/api/v1/p2p' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Api-Access-Token: <Api-Access-Token>' \
--data-raw '{
"shopId": 1234,
"p2p": {
"cost": {
"amount": "100.50",
"currency": "USD"
},
"p2pNumber": "P2P-ABC-123456",
"localDateTime": "2023-03-06T14:15:23"
},
"p2pSettings": {
"providerCode": "someProvider",
"instrumentType": "card"
},
"recipient": {
"cardData": {
"cardNumber": "4111111111111112"
}
},
"sender": {
"personalData": {
"firstName": "Bob",
"lastName": "Green"
},
"addressData": {
"countryCode": "US",
"street": "123 Apple St."
},
"cardData": {
"cardNumber": "4111111111111111",
"cardHolderName": "JOHN A DOE",
"expireMonth": "12",
"expireYear": "2024",
"cvv": "123"
}
},
"paymentPageDesign": {
"format": "shop_hosted"
}
}'
- Response (PCI DSS)
{
"data": {
"p2pNumber": "P2P-ABC-123456",
"p2pStatus": "in_progress"
}
}
2. Callback or Check P2P Transaction Status
Once the P2P transfer is initiated, you will receive a callback when the transaction status changes. You can also call the Retrieve P2P Transaction Status endpoint to get the current status.
- Request
curl -L 'https://gateway.madfintech.com/api/v1/p2p/1234/P2P-ABC-123456' \
-H 'Accept: application/json' \
-H 'Api-Access-Token: <Api-Access-Token>'
- Response
{
"data": {
"shopId": 1234,
"id": 54222,
"p2pStatus": "in_progress",
"p2pNumber": "P2P-ABC-123456",
"cost": {
"amount": "100.50",
"currency": "USD"
},
"p2pCreatedAt": "2023-08-29T15:34:56+03:00",
"p2pPaidAt": "2023-08-29T15:34:56+03:00",
"p2pTransactions": [
{
"transactionId": "79",
"providerTransactionId": "990943",
"cost": {
"amount": "100.50",
"currency": "USD"
},
"provider": {
"code": "someProvider"
},
"instrumentType": "card",
"status": {
"status": "completed"
}
}
],
"p2pDetails": {
"recipient": {
"maskedCardNumber": "411111******1112"
},
"sender": {
"maskedCardNumber": "411111******1111"
}
}
}
}