Create a Payment Card
Creates and saves a payment card for a user. This API is triggered when the user saves the payment card on the mobile application.
- Type: stringx
-pch -digest requiredThe signature for the API call
- Type: stringContent
- Type requiredSet this header to application/json.
- Type: stringAccept
- Language Preferred language
- Type: stringUser
- Agent requiredUsed to identify the software, device, and application initiating the request, providing information about the client to the server. For details, see User Agent.
- Type: stringpunchh
-app -device -id requiredThe app device ID helps Punchh identify each device so that certain rewards can be awarded individually to each device instead of per user. For example, the sign-up reward is given to each device ID to prevent fraudulent sign-ups so that a user cannot do repeated sign-ups from a single device to get rewards. It should not change even if the user resets a device. See the sample code to generate the punchh-app-device-id header.
- Type: stringAuthorizationrequired
Used to authorize the request with access_token. It should be supplied as
Bearer ACCESS_TOKEN_GOES_HERE. - Type: stringAcceptrequired
Advertises which content types the client is able to understand
- Type: stringadapter
_code requiredName of the payment processor / payment gateway. Valid value is par_payment.
- Type: stringclientrequired
OAuth client ID provided by the business
- Type: stringtransaction
_token requiredUnique digital identifier/token of the user's payment card provided by the payment processor
- Type: objectbilling
_info Billing information of the cardholder
- Type: stringnickname
Payment card nickname, as set by the user
- Type: booleanpreferred
This value determines whether this card will be selected as the default card or not when the user makes a payment through the mobile application. If the value is set to true, this card will be selected as the default card for payments. Valid values are true or false.
- application/json
- application/json
- application/json
- application/json
curl https://SERVER_NAME_GOES_HERE.punchh.com/api2/mobile/payment_cards \
--request POST \
--header 'x-pch-digest: {{$$.env.signature}}' \
--header 'Content-Type: application/json' \
--header 'Accept-Language: en' \
--header 'User-Agent: AppName/AppVersion/BuildNumber (OS; Model; MANUFACTURER; MODEL; OS Version)' \
--header 'punchh-app-device-id: APP_DEVICE_ID_GOES_HERE' \
--header 'Authorization: Bearer ACCESS_TOKEN_GOES_HERE' \
--header 'Accept: application/json' \
--data '{
"client": "<CLIENT_ID_GOES_HERE>",
"transaction_token": "<TRANSACTION_TOKEN_GOES_HERE>",
"adapter_code": "<ADAPTER_CODE_GOES_HERE>",
"preferred": true,
"nickname": "NICKNAME_GOES_HERE",
"billing_info": {
"name": "CUSTOMER_NAME_GOES_HERE",
"country": "USA",
"zip_code": "ZIP_CODE_GOES_HERE"
}
}'
{
"uuid": "<UUID_GOES_HERE>",
"nickname": "<NICKNAME_GOES_HERE>",
"preferred": true,
"card_details": {
"name_on_card": "<CARDHOLDER_NAME_GOES_HERE>",
"cc_4": "4242",
"card_type": "Visa",
"expiry_month": "02",
"expiry_year": "28"
}
}