The Intent feature is about showing active, inactive (and potentially lost) payments. It achieves this by the user dropping an SDK on their checkout page, which is activated when a user lands on the page to checkout.
startIntent
starts a new Intent
and returns a unique intentId
. This starts the process of tracking the lifecycle of the checkout. You can also use the intentId
in subsequent API calls. This starts the tracking process of a new checkout. Starting a new Intent also starts a new a instance of a payment processing automation. You can use this intentId
when calling Optimise or Authorise Payment.
You must pass us your flowId
when starting an Intent.
trackingId
ID ﹡ A unique tracking id for tracking the intent on your site
e.g. an order id or checkout id
paymentFlowId
String ﹡ customer
IntentCustomerInput customer.id
String customer.email
String customer.name
String customer.isGuest
Boolean amount
IntentAmountInput amount.amount
Long amount.currency
String ISO 4217 Code e.g. EUR
location
IntentLocationInput location.country
String Three-letter country codes in ISO 3166-1 alpha-3.
cart
IntentCart cart.id
String cart.weight
Int cart.itemCount
Int cart.items
[IntentCartItemType] curl
-X POST
-H "Content-Type: application/json"
-H "Authorization: Bearer xxxxxxx"
-d '{
"query": "mutation startIntent($trackingId: ID!,$paymentFlowId: ID!, $customer: IntentCustomerInput, $amount: IntentAmountInput!, $location: IntentLocationInput, $cart: IntentCartInput) {
startIntent(trackingId: $trackingId, paymentFlowId: $paymentFlowId,customer: $customer, amount: $amount, location: $location, cart: $cart) {
id
trackingId
paymentFlowId
status
statusDate
date
currency
amount {
formattedAmount
}
location {
country
}
customer {
id
isGuest
}
timeline {
intentStarted {
status
date
}
shipping {
status
date
}
delivery {
status
date
}
billing {
status
date
}
paymentAttempts {
status
date
}
completeIntent {
status
date
}
}
linkedPayments {
paymentId
status
time
title
}
cart {
id
weight
itemCount
items {
id
quantity
title
variantTitle
weight
taxable
requiresShipping
price
sku
lineTotal
image
discountedPrice
totalDiscount
}
}
}
}",
"variables": {
"trackingId": "9f45995a-5129-438d-9459-dc4678510918",
"paymentFlowId": "e76c5829-9928-425f-a815-7024d9164f2a",
"customer": {
"isGuest": true
},
"amount": {
"amount": 5999,
"currency": "USD"
}
}
}'
https://api.whenthen.com/api/graphql
id
Boolean date
DateTime trackingId
String A unique tracking id for tracking the intent on your site
e.g. an order id or checkout id
paymentFlowId
String currency
String ISO 4217 Code e.g. EUR
amount
Amount status
CheckoutStatus statusDate
DateTime location
CheckoutLocation location.country
Three-letter country codes in ISO 3166-1 alpha-3.
customer
CheckoutCustomer customer.id
String customer.isGuest
Boolean customer.email
Boolean customer.name
Boolean timeline
timeline timeline.intentStarted
IntentTimelineStep timeline.shipping
IntentTimelineStep timeline.delivery
IntentTimelineStep timeline.billing
IntentTimelineStep timeline.paymentAttempts
[IntentTimelineStep] timeline.completeIntent
IntentTimelineStep linkedPayments
[LinkedPayment] linkedPayments.paymentId
String linkedPayments.status
PaymentStatus linkedPayments.time
DateTime linkedPayments.title
String cart
IntentCart cart.id
String cart.weight
Int cart.itemCount
Int cart.items
[IntentCartItemType] {
"id":"88b56c86-3e0f-4630-ae27-37b3dfa44ba2",
"date":"2022-03-31T08:28:08.022971Z",
"paymentFlowId":"1a1b53d2-e97d-4626-b8fc-20f758ae42c1",
"trackingId":"d8c239e8-7bb5-4575-9473-ba0f3c67b97d",
"currency":"USD",
"amount":{
"rawAmount":100,
"currency":"USD",
"formattedAmount":"$1.00"
},
"status":"ACTIVE",
"statusDate":"2022-03-31T08:28:08.02318Z",
"location":{
"country":"USA"
},
"customer":{
"id":null,
"isGuest":true,
"email":"test@email.com",
"name":"Customer Name"
},
"timeline":{
"intentStarted":{
"status":"IN_PROGRESS",
"date":"2022-03-31T08:28:08.024711Z"
},
"shipping":{
"status":"NOT_STARTED",
"date":null
},
"delivery":{
"status":"NOT_STARTED",
"date":null
},
"billing":{
"status":"NOT_STARTED",
"date":null
},
"paymentAttempts":[
{
"status":"NOT_STARTED",
"date":null
}
],
"completeIntent":{
"status":"NOT_STARTED",
"date":null
}
},
"linkedPayments":[
{
"paymentId":"payments:32e7a92b-aa07-48d9-86f2-b717c54d0e12",
"status":"ACTIVE",
"time":"2022-03-31T08:28:08.317531Z",
"title":"Payment attempt #1"
}
],
"cart":{
"id":"b5022fb1-1fc6-4791-a993-fe2fc5e19b0d",
"weight":12,
"itemCount":1,
"items":[
{
"id":"4c5296c6-b3a8-4cb6-8a7e-2cb2cf4f3cad",
"quantity":2,
"title":"Test Title",
"variantTitle":"Variant Title",
"weight":64,
"taxable":true,
"requiresShipping":true,
"price":30,
"sku":"d4241bf4-618a-4f33-a843-e4b0ffb310c8",
"lineTotal":100,
"image":"some image url",
"discountedPrice":21,
"totalDiscount":21
}
]
}
}
Use getIntent
to get the details of a particular checkout by passing in the id.
id
String ﹡ curl
-X POST
-H "Content-Type: application/json"
-H "Authorization: Bearer xxxxxxx"
-d '{
"query": "query getIntent($id: ID!) {
getIntent(id: $id) {
id
trackingId
paymentFlowId
status
statusDate
date
currency
amount {
formattedAmount
rawAmount
}
location {
country
}
customer {
id
isGuest
email
name
}
timeline {
intentStarted {
status
date
}
shipping {
status
date
}
delivery {
status
date
}
billing {
status
date
}
paymentAttempts {
status
date
}
completeIntent {
status
date
}
}
linkedPayments {
paymentId
status
time
title
}
cart {
id
weight
itemCount
items {
id
quantity
title
variantTitle
weight
taxable
requiresShipping
price
sku
lineTotal
image
discountedPrice
totalDiscount
}
}
}
}",
"variables": {
"id": "811ab3e2-6f24-493d-bcaa-a95395bc16a2"
}
}'
https://api.whenthen.com/api/graphql
Use updateIntent
to update any of the intent details or status.
For example, here we are changing the shipping form status to COMPLETE
and delivery form status to IN_PROGRESS
id
ID ﹡ trackingId
String A unique tracking id for tracking the intent on your site
e.g. an order id or checkout id
customer
IntentCustomerInput customer.id
String customer.email
String customer.name
String customer.isGuest
Boolean amount
IntentAmountInput amount.amount
Long amount.currency
String ISO 4217 Code e.g. EUR
location
IntentLocationInput If location is specified it will be used.
If location is not specified we will use GeoLocation
location.country
String Three-letter country codes in ISO 3166-1 alpha-3.
cart
IntentCartInput cart.items
[IntentCartItem] billing
IntentShippingInput billing.status
FormStepStatus shipping
IntentShippingInput shipping.status
FormStepStatus delivery
IntentDeliveryInput delivery.status
FormStepStatus curl
-X POST
-H "Content-Type: application/json"
-H "Authorization: Bearer xxxxxxx"
-d '{
"query": "mutation updateIntent($id: ID!, $trackingId: String, $customer: IntentCustomerInput, $amount: IntentAmountInput, $shipping: IntentShippingInput, $delivery: IntentDeliveryInput, $location: IntentLocationInput) {
updateIntent(id: $id, trackingId: $trackingId, customer: $customer, amount: $amount, shipping: $shipping, delivery: $delivery, location: $location){
id
trackingId
paymentFlowId
status
date
currency
amount {
formattedAmount
}
location {
country
}
customer {
id
isGuest
}
timeline {
intentStarted {
status
date
}
shipping {
status
date
}
delivery {
status
date
}
billing {
status
date
}
completeCheckout {
status
date
}
}
}
}",
"variables": {
"id": "811ab3e2-6f24-493d-bcaa-a95395bc16a2",
"customer": {
"id": "2",
"email": "john@test.com",
"name": "John Smith"
},
"amount": {
"amount": 222,
"currency": "EUR"
},
"paymentIntent": {
"status": "NOT_STARTED",
"outcome": "DECLINED",
"paymentMethod": "CARD 2",
"sca": true
},
"shipping": {
"status": "IN_PROGRESS"
},
"delivery": {
"status": "COMPLETE"
}
}
}'
https://api.whenthen.com/api/graphql
Use completeIntent
to complete any of the intent details or status..
id
ID ﹡ paymentReference
ID curl
-X POST
-H "Content-Type: application/json"
-H "Authorization: Bearer xxxxxxx"
-d '{
"query": "mutation completeIntent($id: ID!, $paymentReference: ID) {
completeIntent(id: $id, paymentReference: $paymentReference){
id
trackingId
paymentFlowId
status
date
currency
amount {
formattedAmount
}
location {
country
}
customer {
id
isGuest
}
timeline {
intentStarted {
status
date
}
shipping {
status
date
}
delivery {
status
date
}
billing {
status
date
}
completeCheckout {
status
date
}
}
}
}",
"variables": {
"id": "811ab3e2-6f24-493d-bcaa-a95395bc16a2",
"paymentReference": "f6sepsen"
}
}'
https://api.whenthen.com/api/graphql
amount in minor units.
ISO 4217 Code e.g. EUR
formatted amount
Currently in Intent status. The beginning of the life cycle.
Status when startIntent
is called.
The payment intent is active. Status once updateIntent
is called
The payment intent is no longer active. Occurs after 5 mins of inactivity
The payment intent is completed. The customer has completed their purchase