Set Up Virtual Card for In-Store
Generate Affirm Virtual Cards from your point-of-sale (POS) system to offer flexible payment options for customers in-store. Learn about initiating checkouts, sending payment links, authorizing transactions, and managing orders for a seamless customer experience.
Prerequisites
- Review About Virtual Card for In-Store.
Steps
1. Initiate In-Store Checkout
Sales associate selects Affirm as a payment option from your point-of-sale (PoS) system. This action triggers a request to Affirm to text or email a checkout link to the customer directly.
When the customer checks out, your client sends their order details client-side to Affirm. Then, we render the checkout experience for the customer. Lastly, we return a checkout_token
in the success callback on their loan confirmation.
When building the checkout object for the Virtual Card In-Store flow, set the use_vcn
attribute to true
on the merchant object.
POST /api/v2/checkout/store HTTP/1.1
Host: sandbox.affirm.com
Content-Type: application/json
{
"merchant": {
"public_api_key": "PUBLIC_API_KEY",
"user_cancel_url": "https://www.google.com",
"user_confirmation_url": "https://www.affirm.com",
"user_confirmation_url_action": "POST",
"name": "In-store Affirm demo"
},
"billing":{
"name":{
"full": "John Doe"
},
"address":{
"line1": "325 Pacific Ave",
"city": "San Francisco",
"state": "CA",
"zipcode": "94112",
"country": "USA"
},
"phone_number": "4155552222",
"email": "[email protected]"
},
"metadata": {
"entity_name": "Vignan 1234",
"store_location": "Denver"
},
"order_id": "00de5cee-7226-4aec-b729-a571f773a58c",
"total": 5000
}
Receiving the Checkout URL
The Store API will send SMS text messages only in the Affirm Live environment. During Sandbox environment testing, please rely on email messages to receive the Checkout URL to complete your Affirm purchase.
2. Webhook Confirm Event
When a user confirms their loan, Affirm's server is notified of that event. We POST the checkout_id
back to your server at the webhook URL you provide.
3. Create Order
Affirm's server POSTs a checkout event containing the checkout_id
back to your server. This checkout_id
, also called the transaction_id
, must be authorized securely before you save the order or update the order's status on the in-store terminal.
4. In-Store Confirmation
Once the order is successfully authorized, the in-store terminal must be able to receive the order confirmation and reflect paid status in near-real-time.
5. Manage Order
You can initiate different transaction actions depending on your internal processes.
What’s Next?
Updated about 19 hours ago