What is a User-Agent and why do I need to have one?
A User-Agent header must be supplied with all payments API requests.
A User-Agent header is used by the Afterpay team to identify which Merchant website and Platform, API requests are coming from. It also helps to categorise the transactions based on channel and service for financial settlement/invoicing
For example:
Merchant/abc; Platform/Digital; MerchantId/abc771; Channel/sms; CountryCode/AU; System Information/Java/8.3; Service/Shop
Description | Example Data Above | Other Merchant Examples |
---|---|---|
Merchant | Merchant/abc | Merchant/Nab Merchant/ANZ ; Merchant/Optus |
Platform | Platform/digital | Platform/Upwire |
MerchantId | MerchantId/abc771 | MerchantId/NAB12 |
Channel | Channel/SMS | Channel/Web Channel/msite Channel/app Channel/ivr Channel/autopayment |
CountryCode | CountryCode/AU | CountryCode/US CountryCode/EU |
System Information | System Information/Java/8.3 | System Information/PHP/7.2.18 System Information/Ruby/2.5.3 |
Service | Service/Auto-recharge | Service/Recharge Service/Activation Service/Shop Service/Unlock |
Sample Example
curl -v -X POST https://<env>/v1/reservations \
-H "Authorization: Bearer c92b326fff28aba21821349c3ef411e" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Request-Id: 8456732415666565656565656565657" \
-H "User-Agent: Merchant/Abc; Platform/Crimson; MerchantId/ABC123; Channel/sms; CountryCode/AU System Information/Java/8.3; Service/Auto-recharge"\
-d '{
"token": "6966af4975984c30ae2e2c18985bc21c",
"amount": 100.5,
"currency": "AUD",
"risk": {...},
"requestor": "61402223333"
}'