Handling completed checkout-sessions
Gain a better understanding of how to handle checkout-sessions after Digital River creates the order
If you're using either of our low-code checkout solutions, we recommend that you configure a webhook to listen for the event with a type of checkout_session.order.created.
This event occurs when customers complete their purchase, and Digital River converts the checkout-session to an order. Its data.object allows you to:
Save a copy of our order in your database
Retrieve
idand add that value to the order in your system
We don’t recommend that you use checkout_session.order.created to trigger order fulfillment or customer notifications. Instead, listen for order.accepted and use it to trigger downstream fulfillment processes and order confirmation emails. For details, refer to:
Handling accepted orders on the Processing orders page
Order confirmation on the Customer notifications page
Determine whether to save addresses
In the data.object of checkout_session.order.created, both shipTo and billTo contain the saveForLater boolean indicates whether customers requested that their shipping and/or billing information be saved for future transactions.
{
"id": "b927e8ef-fd8e-41a5-af29-04206b24dbb8",
"type": "checkout_session.order.created",
"data": {
"object": {
"id": "262957510336",
"checkoutId": "3a71cfd1-da2b-4378-833f-3c9ad6fcf447",
"checkoutSessionId": "fa701918-4f4c-45a9-8f72-88064070b927",
...
"shipTo": {
"address": {
"line1": "10380 Bren Rd W",
"city": "Minnetonka",
"postalCode": "55129",
"country": "MN"
},
"name": "John Smith",
"phone": "952-111-1111",
"email": "[email protected]",
"additionalAddressInfo": {
"neighborhood": "Centro",
"phoneticName": "ヤマダ タロ"
},
"saveForLater": true
},
...
"billTo": {
"address": {
"line1": "10380 Bren Rd W",
"city": "Minnetonka",
"postalCode": "55129",
"country": "FR"
},
"name": "John Smith",
"phone": "09521111111",
"email": "[email protected]",
"saveForLater": false
},
...
}
},
...
}If true, you can call a method that saves address, name, phone, email, and (assuming it exists) additionalAddressInfo in your system so that the next time this customer checks out, you can pass this data in options.addresses[].
Determine what disclosures customers accepted
The data.object of checkout_session.order.created contains consents.
{
"id": "1ebfd13c-4ef6-443c-b58a-cb119f1c24fd",
"type": "checkout_session.order.created",
"data": {
"object": {
"id": "1038474530082",
...
"consents": {
"termsOfService": true,
"eula": true,
"termsOfSale": true
},
...
}
},
...
}In this object, the termsOfSale boolean references Digital River's terms of sale. The eula and termsOfService reference your company's unique end-user license agreement and terms of service, respectively.
If any of these attributes are true, it signifies that customers were presented with that specific disclosure during the payment stage and actively accepted it.
Access price formatting rules
For details, refer to Access price formatting rules on the Offering local pricing page.
Determine whether customers applied store credit
For details, refer to Processing store credit in orders on the Offering store credit page.
Last updated