Private Key

Create a payment for a customer or payment method. The payment method will be authorised and return a status of AUTHORISED.

The payment will be captured immediately, and return a status of SUCCEEDED .

If you have created a capture automation , then capture will only take place when your automation runs.

You should provide a payment method token here to reduce PCI requirement. You will be eligible for the simplest method of PCI validation: SAQ A.

Idempotency

The Create a Payment API supports Idempotency.

Request

ValueType
  • orderIdString

    An optional order id you can use for tracking

  • flowIdString

    The flow to use for this payment.

    You can get the flow id from developer settings in the web application

  • intentIdString

    If you are using Intent API, provide the id for an intent.

    This allows you to available of additional data points while creating an automation

  • currencyCodeString

    ISO 4217 Code e.g. EUR

  • amountLong

    Amount in minor units e.g. 5099 = 50.99

  • paymentMethodPaymentMethodDtoInput
  • paymentMethod.tokenString

    The token for the payment method.

    Only this field is needed to create a payment using a token.

    All other card fields can be ignored

  • paymentMethod.typeString

    e.g. CARD, APPLE_PAY, GOOGLE_PAY, PAYPAL, KLARNA

  • paymentMethod.walletTokenJSON

    The wallet token. When providing this, amount and currency are not needed.

  • paymentMethod.cardCardInputDto

    If you want to create a payment for a full card

  • paymentMethod.googlePayGooglePayInput

    Google Pay specific data

  • customerpaymentMethodCustomerDtoInput

    Customer to associate with a payment

  • customer.idString

    Customer id if you have previously created the customer

  • customer.emailString

    Customer email

  • customer.nameString

    Customer name

  • descriptionString

    A desc for the payment

  • metadataJSON

    Use this to store custom data about this payment

  • perform3DSecureConfig3DSecure

    3D Secure options

  • perform3DSecure.redirectUrlString

    Redirect to the url indicated after customer finishes the 3D Secure authentication process

  • apmRedirectUrlString

    When performing a payment for an APM, this is the URL that we will redirect back to.

  • fraudObject

    Pass fraud data from your custom fraud service provider.

CURL
curl
-X POST
-H "Content-Type: application/json"
-H "Authorization: Bearer xxxxxxx"
-d '{
	"query": "mutation authorizePayment($authorisePayment: AuthorisedPaymentInput!) {
    authorizePayment(authorisePayment: $authorisePayment) {
       id
       status
    }
  }",
	"variables": {
		"authorisePayment": {
			 "orderId": "557512fb-e5f3-45ce-9e60-b9418b92153b",
			 "flowId": "2d0fc623-f1ca-4051-b60a-7366ca14783c",
			 "intentId": "9106d9e7-87ba-4b39-9e99-599559aede60",
			 "amount": 100,
			 "currencyCode": "ISO 4217",
       "paymentMethod": {
        "type": "CARD",
        "token": "213dfsfd"
      },
			 "customer": {
				 "id": "1ba5d56b-f6d6-4170-b246-ca886d1e111f"
			 },
			 "description": ""
		}
	}
}'
https://api.whenthen.com/api/graphql

Response

ValueType
  • idID
    unique payment ID
  • sourceIdString
    identifier from gateway
  • orderIdString
    An optional order id you can use for tracking
  • connectionIdString
  • dateDateTime
    date and time, ISO format
  • statusPaymentStatus
  • amountAmount
    the payment amount, minor units
  • refundedAmountLong
    the total refunded payment amount, minor units
  • currencyString

    ISO 4217 Code e.g. EUR

  • countryString
  • eciString

    Electronic Commerce Indicator (ECI) is a value returned by Directory Servers (namely Visa, MasterCard, JCB, and American Express) indicating the outcome of authentication attempted on transactions enforced by 3DS

  • paymentProcessingOriginEnum

    AUTOMATION HEADLESS IMPORT

  • threeDSecureVersionString

    Version of 3DSecure being used for authentication

  • threeDSecureAuthenticationResultString

    Whether the authentication check was successful or not

  • paymentGatewayPaymentGateway
  • paymentGateway.nameString
    Gateway Name
  • paymentGateway.logoString
    Gateway Logo
  • paymentCorePaymentCore
  • paymentCore.processorStatusString
    Payment processor's status for the payment
  • paymentCore.paymentMethodPaymentMethod
  • paymentCore.outcomePaymentOutcome
  • paymentDetailsPaymentDetails
  • paymentDetails.statementDescriptorString
    what appears on customer statement
  • paymentDetails.localCurrencyString

    ISO 4217 Code e.g. EUR

  • paymentDetails.localAmountAmount
  • paymentDetails.exchangeRateString
  • paymentDetails.feeAmount
  • paymentDetails.taxAmount
  • paymentDetails.processingFeeAmount
  • paymentDetails.netAmount
  • paymentDetails.descriptionString
    A description for the payment processor or authorise api
  • paymentTimelinePaymentTimeline
  • paymentTimeline.overview[PaymentTimelineEvent]
    Collection/List of timeline events
  • paymentTimeline.flows[FlowSummary]
    Collection/List of flows
  • paymentCustomerPaymentCustomer
  • paymentCustomer.idString
    customer id
  • paymentCustomer.emailString
    customer email
  • paymentCustomer.nameString
    customer name
  • paymentMethodDetailsPaymentMethodDetails
  • paymentMethodDetails.idString
    payment method id
  • paymentMethodDetails.numberString
    masked .. or last four
  • paymentMethodDetails.expiresString
    Expiry date in MM/YYYY format
  • paymentMethodDetails.fingerprintString
  • paymentMethodDetails.paymentMethodPaymentMethod
  • paymentMethodDetails.typePaymentMethodCardtype
  • paymentMethodDetails.productString
    Payment card product
  • paymentMethodDetails.issuingBankString
  • paymentMethodDetails.categoryString
    Category of the card.
  • paymentMethodDetails.countryString
  • paymentMethodDetails.brandString
  • paymentMethodDetails.nameString
  • attachments[Attachment]
    Collection/List of attachments
  • attachments.idString
    id of attachment
  • attachments.fileNameString
    file name of attachment
  • attachments.objectKeyString
    object key for atachment
  • attachments.contenttypeString
    attachment content type
  • attachments.accessUrlString
    attachment url
JSON
{
   "id":"4a027d61-e645-478b-b7aa-91bf0cdd0d71",
   "date":"2022-09-14T20:58:05.387297Z",
   "country":"USA",
   "amount":{
      "formattedAmount":"€90.02"
   },
   "refundedAmount": null,
   "status":"SUCCEEDED",
   "paymentGateway":{
      "id":"0268a1f6-c203-4697-bf6f-a90e261f0222",
      "name":"Braintree",
      "logo":"https://media.graphcms.com/output=format:jpg/resize=,width:59,height:59,fit:crop/4N2n4aZ7SX6GIbaCS728"
   },
   "paymentCore":{
      "paymentMethod":"AMEX",
      "outcome":{
         "networkStatus":null,
         "reason":null,
         "riskLevel":null,
         "riskScore":null,
         "type":"PAYMENT"
      }
   },
   "paymentDetails":{
      "statementDescriptor":null,
      "localCurrency":"EUR",
      "localAmount":{
         "formattedAmount":"€90.02"
      },
      "exchangeRate":"null",
      "fee":null,
      "tax":null,
      "processingFee":null,
      "net":null,
      "description":null
   },
   "paymentTimeline":{
      "overview":null,
      "flows":null
   },
   "paymentConnections":{
      "latestCharge":"2022-02-28T10:36:51Z",
      "invoice":null,
      "payout":null
   },
   "paymentCustomer":{
      "id":"179644955",
      "email":"sduly1f@multiply.com"
   },
   "paymentMethodDetails":{
      "id":"dg4kg9g",
      "number":"0004",
      "expires":"06/2024",
      "fingerprint":null,
      "paymentMethod":"AMEX"
   },
   "paymentReceipt":null,
   "attachments":[

   ]
}

Capture

Mutation
Private Key

Capture the funds of an existing Payment when its status is AUTHORISED,

You can capture a payment for the original amount, or you can provide an amount less than the original amount.

Amounts should be sent in minor units.

The currency from the original payment will be used.

If no amount is sent the the original payment amount is captured. If you provide an amount then this value will be captured.

Uncaptured Payments will be cancelled after approximately seven days. This can different per PSP. You should check the rules with your given PSP.

You only need to use this API if you have created a delayed capture automation, and have selected API as the mehod.

Request

ValueType
  • idID

    The id to cancel

  • amountLong

    If amount is not provided then the original amount of the payment authorisation will be used.

    You can capture for an amount less than the original payment amount.

    Amounts should be sent in minor units

CURL
curl
-X POST
-H "Content-Type: application/json"
-H "Authorization: Bearer xxxxxxx"
-d '{
   "query": "mutation capturePayment($id: ID!, $amount: Long) {
     capturePayment(id: $id, amount: $amount) {
        id
        status
     }
   }",
   "variables":{
      "id": "cc9d00ac-1c85-400f-8ad1-958100ca0e06",
      "amount": 10000
   }
}'
https://api.whenthen.com/api/graphql

Refund

Mutation
Private Key

A Payment can be refunded when it has a status of SUCCEEDED,

A Payment with a status of AUTHORISED should be cancelled

Funds will be refunded to the customer's payment method.

Request

ValueType
  • idID
    The id to cancel
  • amountLong

    If amount is not provided then the original amount of the payment authorisation will be used.

    You can capture for an amount less than the original payment amount.

    Amounts should be sent in minor units

  • reasonString
    Reason the payment was cancelled
CURL
curl
-X POST
-H "Content-Type: application/json"
-H "Authorization: Bearer xxxxxxx"
-d '{
   "query": "mutation refundPayment($id: ID!, $amount: Long, $reason: String) {
      refundPayment(id: $id, amount: $amount, reason: $reason) {
        id
        status
     }
   }",
   "variables":{
      "id": "cc9d00ac-1c85-400f-8ad1-958100ca0e06",
			"amount": 10000,
      "reason":"some reason"
   }
}'
https://api.whenthen.com/api/graphql

Cancel

Mutation
Private Key

A Payment can be cancelled when it has a status of AUTHORISED,

When a payment is cancelled, your PSP will not charge you any fees for the payment and payment will be refunded to the customer.

Request

ValueType
  • idID

    The id to cancel

  • reasonString

    Reason the payment was cancelled

CURL
curl
-X POST
-H "Content-Type: application/json"
-H "Authorization: Bearer xxxxxxx"
-d '{
   "query": "mutation cancelPayment($id: ID!, $reason: String) {
     cancelPayment(id: $id, reason: $reason) {
       id
       status
      }
  }",
   "variables":{
      "id":"cc9d00ac-1c85-400f-8ad1-958100ca0e06",
      "reason":"some reason"
   }
}'
https://api.whenthen.com/api/graphql
Private Key

Request

ValueType
  • idID

    The id of the payment

CURL
curl
-X POST
-H "Content-Type: application/json"
-H "Authorization: Bearer xxxxxxx"
-d '{
   "query": "query getPayment($id: ID!) {
      getPayment(id: $id) {
        id
        status
      }
  }",
   "variables":{
      "id":"cc9d00ac-1c85-400f-8ad1-958100ca0e06"
   }
}'
https://api.whenthen.com/api/graphql

Setup Wallet

Mutation
Client TokenPrivate Key

Request

ValueType
  • walletTypeString
    Wallet Type that will be processed (e.g. APPLE_PAY, GOOGLE_PAY...)
  • payloadJSON
    Custom JSON payload that conveys the required data depending on the wallet type
CURL
curl
-X POST
-H "Content-Type: application/json"
-H "Accept: */*"
-H "Authorization: Bearer xxxxxxx"
-d '{
	"query":"mutation setupWallet($walletType: String!, $payload: JSON!) {
    setupWallet(walletType: $walletType, payload: $payload)
  }",
  "variables":{
    "walletType": "APPLE_PAY",
    "payload": {
      "merchantIdentifier": "merchant.com.whenthen",
      "displayName": "TestStore",
      "validationUrl": "apple-pay-gateway-cert.apple.com",
      "initiativeContext": "whenthen-checkout-sdk-ui-applepay-sandbox-app-test"
    }
  }
}'
https://api.whenthen.com/api/graphql

Response

ValueType
  • epochTimestampLong
    Merchant session creation time that is represented in number of seconds that have elapsed since 00:00:00 UTC, Thursday, January 1, 1970.
  • expiresAtLong
    Session expiry time (session expires after five minutes). Time is represented in number of seconds that have elapsed since 00:00:00 UTC, Thursday, January 1, 1970.
  • merchantSessionIdentifierString
    A unique identifier that represents a merchant's session for Apple Pay.
  • nonceString
    A single-use string that checks the integrity of the interaction.
  • merchantIdentifierString
    A unique identifier that represents a merchant for Apple Pay
  • domainNameString
    Domain name
  • displayNameString
    A string of 64 or fewer UTF-8 characters containing the canonical name for your store, suitable for display.
  • signatureString
    A hash of the public key used to sign the interactions.
  • operationalAnalyticsIdentifierString

    Combination of the displayName and merchantIdentifier
    (displayName :merchantIdentifier)

  • retriesInteger
JSON
{
 "data": {
   "setupWallet": {
      "epochTimestamp": 1648025487112,
      "expiresAt": 1648029087112,
      "merchantSessionIdentifier": "SSH45A996427C384416BFC1A40E588782A3_345435345354435342342324223",
      "nonce": "111111111",
      "merchantIdentifier": "2EAA91E49EB1BE8D8ED23A6F6F1940419F33B288F75790615CFF409760095799",
      "domainName": "whenthen-checkout-sdk-ui-applepay-sandbox-app-test",
      "displayName": "TestStore",
      "signature": "308006032323232d010702a0803080020101310f300d06096086480165030402010500308006092a864886f70d0107010000a080308203e43082038ba003020102020859d8a1bcaaf4e3cd300a06082a8648ce3d040302307a312e302c06035504030c254170706c65204170706c69636174696f6e20496e746567726174696f6e204341202d20473331263024060355040b0c1d4170706c652043657274696669636174696f6e20417574686f7269747931133011060355040a0c0a4170706c6520496e632e310b3009060355040613025553301e170d3231303432303139333730305a170d3236303431393139333635395a30623128302606035504030c1f6563632d736d702d62726f6b65722d7369676e5f5543342d53414e44424f5831143012060355040b0c0b694f532053797374656d7331133011060355040a0c0a4170706c6520496e632e310b30090603550406130255533059301306072a8648ce3d020106082a8648ce3d030107034200048230fdabc39cf75e202c50d99b4512e637e2a901dd6cb3e0b1cd4b526798f8cf4ebde81a25a8c21e4c33ddce8e2a96c2f6afa1930345c4e87a4426ce951b1295a38202113082020d300c0603551d130101ff04023000301f0603551d2304183016801423f249c44f93e4ef27e6c4f6286c3fa2bbfd2e4b304506082b0601050507010104393037303506082b060105050730018629687474703a2f2f6f6373702e6170706c652e636f6d2f6f63737030342d6170706c65616963613330323082011d0603551d2004820114308201103082010c06092a864886f7636405013081fe3081c306082b060105050702023081b60c81b352656c69616e6365206f6e207468697320636572746966696361746520627920616e7920706172747920617373756d657320616363657074616e6365206f6620746865207468656e206170706c696361626c65207374616e64617264207465726d7320616e6420636f6e646974696f6e73206f66207573652c20636572746966696361746520706f6c69637920616e642063657274696669636174696f6e2070726163746963652073746174656d656e74732e303606082b06010505070201162a687474703a2f2f7777772e6170706c652e636f6d2f6365727469666963617465617574686f726974792f30340603551d1f042d302b3029a027a0258623687474703a2f2f63726c2e6170706c652e636f6d2f6170706c6561696361332e63726c301d0603551d0e041604140224300b9aeeed463197a4a65a299e4271821c45300e0603551d0f0101ff040403020780300f06092a864886f76364061d04020500300a06082a8648ce3d0403020347003044022074a1b324db4249430dd3274c5074c4808d9a1f480e3a85c5c1362566325fbca3022069369053abf50b5a52f9f6004dc58aad6c50a7d608683790e0a73ad01e4ad981308202ee30820275a0030201020208496d2fbf3a98da97300a06082a8648ce3d0403023067311b301906035504030c124170706c6520526f6f74204341202d20473331263024060355040b0c1d4170706c652043657274696669636174696f6e20417574686f7269747931133011060355040a0c0a4170706c6520496e632e310b3009060355040613025553301e170d3134303530363233343633305a170d3239303530363233343633305a307a312e302c06035504030c254170706c65204170706c69636174696f6e20496e746567726174696f6e204341202d20473331263024060355040b0c1d4170706c652043657274696669636174696f6e20417574686f7269747931133011060355040a0c0a4170706c6520496e632e310b30090603550406130255533059301306072a8648ce3d020106082a8648ce3d03010703420004f017118419d76485d51a5e25810776e880a2efde7bae4de08dfc4b93e13356d5665b35ae22d097760d224e7bba08fd7617ce88cb76bb6670bec8e82984ff5445a381f73081f4304606082b06010505070101043a3038303606082b06010505073001862a687474703a2f2f6f6373702e6170706c652e636f6d2f6f63737030342d6170706c65726f6f7463616733301d0603551d0e0416041423f249c44f93e4ef27e6c4f6286c3fa2bbfd2e4b300f0603551d130101ff040530030101ff301f0603551d23041830168014bbb0dea15833889aa48a99debebdebafdacb24ab30370603551d1f0430302e302ca02aa0288626687474703a2f2f63726c2e6170706c652e636f6d2f6170706c65726f6f74636167332e63726c300e0603551d0f0101ff0404030201063010060a2a864886f7636406020e04020500300a06082a8648ce3d040302036700306402303acf7283511699b186fb35c356ca62bff417edd90f754da28ebef19c815e42b789f898f79b599f98d5410d8f9de9c2fe0230322dd54421b0a305776c5df3383b9067fd177c2c216d964fc6726982126f54f87a7d1b99cb9b0989216106990f09921d00003182018c30820188020101308186307a312e302c06035504030c254170706c65204170706c69636174696f6e20496e746567726174696f6e204341202d20473331263024060355040b0c1d4170706c652043657274696669636174696f6e20417574686f7269747931133011060355040a0c0a4170706c6520496e632e310b3009060355040613025553020859d8a1bcaaf4e3cd300d06096086480165030402010500a08195301806092a864886f70d010903310b06092a864886f70d010701301c06092a864886f70d010905310f170d3232303332333038353132375a302a06092a864886f70d010934311d301b300d06096086480165030402010500a10a06082a8648ce3d040302302f06092a864886f70d010904312204205dc6d4907fc9064370e9ad6cb9045af64ef2ea0af3b43ad04485fb89ac52ba12300a06082a8648ce3d0403020447304502201e2c7599602c4bf266fe27c655ac3666c345829c4fbe994897f3767186309ff902210083826fad63e64fec946ab282dfdf9a6d18631b1372f74decd8a75751ea130f6a000000000000",
      "operationalAnalyticsIdentifier": "TestStore:2EAA91ER434343940419F33B2343243243290615CFF409760095799",
      "retries": 0
   }
 }
}
Private Key

Used to retrieve a list of payments. List could be paginated and several filters applied to drill down to required payment data set.

Request

ValueType
  • firstInit
  • lastInit
  • afterString
  • beforeString
  • dataPaymentFilterInput
  • data.sort[PaymentSortDataInput]
  • data.filterPaymentFilterDataInput
CURL
curl 
-X POST 
-H "Content-Type: application/json" 
-H "Authorization: Bearer xxxxxxx" 
-d '{
   "query":"query listPayments($first: Int, $after: String, $last: Int, $before: String, $data: PaymentFilterInput){
  listPayments(first: $first, after: $after, last: $last, before: $before, data: $data) {
      data {
      id
	    teamId
	    customerId    
	    userId
	    name
	    filter {
          date {
              verbs
	            selectedVerb
          }
	        amount {
	            verbs
	            selectedVerb
          }
	        status {
	            verbs
	            selectedVerb
          }
	        dateRange {
	            verbs
	            selectedVerb
          }
        }
      }
		pageInfo {
			hasNextPage
			hasPreviousPage
			startCursor
			endCursor
      totalSize
		}
		edges {
			cursor
			node {
				id
        date
        country
        amount {
				    formattedAmount
				}
        status
        paymentGateway {
            id
            name
        }
        paymentCore {
            paymentMethod
            outcome {
                networkStatus
                reason
                riskLevel
                riskScore
                type
            }
        }
        paymentDetails {
            statementDescriptor
            localCurrency
            localAmount {
                formattedAmount
            }
            exchangeRate
            fee {
                formattedAmount
            }
            tax {
                formattedAmount
            }
            processingFee {
                formattedAmount
            }
            net {
                formattedAmount
            }
            description
        }
        paymentConnections {
            latestCharge
            invoice
            payout
        }
        paymentCustomer {
            id
            email
        }
        paymentMethodDetails {
          id
          number
          expires
          fingerprint
          paymentMethod 
          type
        }
        paymentReceipt {
            type
          message
          date
          receiptUrl
        }
        attachments {
            fileName
         }
			}
		}
	}
}",
   "variables":{
       "first":10,
       "after":0
   }
}'

https://api.whenthen.com/api/graphql

Response

ValueType
  • ListPaymentsListPayments
  • ListPayments.dataJSON
  • ListPayments.pageInfoPageInfo
  • ListPayments.edges[Array]
  • PaymentFilter
  • PageInfo.hasNextPageBoolean
  • PageInfo.hasPreviousPageBoolean
  • PageInfo.startCursorString
  • PageInfo.endCursorString
  • PageInfo.totalSizeInit
JSON
{
    "data": {
        "listPayments": {
            "data": {
                "id": null,
                "teamId": "58cb5b5e-9223-45a2-b4d0-8d4914d17283",
                "customerId": null,
                "userId": "cd4c18c1-95b8-414b-9f64-e5ac86ba65b4",
                "name": "Default"
            },
            "pageInfo": {
                "hasNextPage": false,
                "hasPreviousPage": false,
                "startCursor": "1",
                "endCursor": "1",
                "totalSize": 1
            },
            "edges": [
                {
                    "cursor": "1",
                    "node": {
                        "id": "payments:f415645d-eda9-4f26-959d-7ea5c67d6896",
                        "date": "2022-06-29T09:14:10Z",
                        "country": "USA",
                        "amount": {
                            "formattedAmount": "€19.81"
                        },
                        "status": "SUCCEEDED",
                        "paymentGateway": {
                            "id": "0268a1f6-c203-4697-bf6f-a90e261f0111",
                            "name": "Stripe",
                            "logo": "https://media.graphcms.com/output=format:jpg/resize=,width:59,height:59,fit:crop/9PSnk32nSg6ovnOkRgdr"
                        },
                        "paymentCore": {
                            "paymentMethod": "VISA",
                            "outcome": {
                                "networkStatus": "approved_by_network",
                                "reason": null,
                                "riskLevel": "NORMAL",
                                "riskScore": 39,
                                "type": "PAYMENT"
                            }
                          
                        },
                        "paymentDetails": {
                            "statementDescriptor": "WHENTHEN",
                            "localCurrency": "USD",
                            "localAmount": {
                                "formattedAmount": "$20.64"
                            },
                            "exchangeRate": "1.04169",
                            "fee": {
                                "formattedAmount": "$0.90"
                            },
                            "tax": {
                                "formattedAmount": "$0.00"
                            },
                            "processingFee": {
                                "formattedAmount": "$0.90"
                            },
                            "net": {
                                "formattedAmount": "$19.74"
                            },
                            "description": null
                        },
                        "paymentTimeline": {
                            "overview": null,
                            "flows": null
                        },
                        "paymentConnections": {
                            "latestCharge": "2022-06-29T09:14:10Z",
                            "invoice": null,
                            "payout": null
                        },
                        "paymentCustomer": {
                            "id": null,
                            "email": null
                        },
                        "paymentMethodDetails": {
                            "id": "4d39b168-4e77-4e4b-9770-9090f248ab68",
                            "number": "**** **** **** 4242",
                            "expires": "06/2024",
                            "fingerprint": "OCv7RJjDQJE3VNvI",
                            "paymentMethod": "VISA",
                            "type": "CREDIT",
                            "product": "Visa Classic",
                            "issuingBank": null,
                            "category": null
                        },
                        "paymentReceipt": {
                            "type": "payment",
                            "message": null,
                            "date": "2022-06-29T09:14:10Z",
                            "receiptUrl": "https://pay.stripe.com/receipts/acct_1KTSlBHhXo8OToPM/ch_3LFwyMHhXo8OToPM1Yqb6EDa/rcpt_LxsjGlrTMs21RHGwtGpYl7loovJWcsz"
                        },
                        "attachments": []
                    }
                },
                {
                    "cursor": "1",
                    "node": {
                        "id": "payments:82b178f3-cc68-43b7-90c4-f4459a281170",
                        "date": "2022-06-29T09:06:28.939515Z",
                        "country": null,
                        "amount": {
                            "formattedAmount": "€19.81"
                        },
                        "status": "DECLINED",
                        "paymentGateway": {
                            "id": "0268a1f6-c203-4697-bf6f-a90e261f0111",
                            "name": "Stripe",
                            "logo": "https://media.graphcms.com/output=format:jpg/resize=,width:59,height:59,fit:crop/9PSnk32nSg6ovnOkRgdr"
                        },
                        "paymentCore": {
                            "paymentMethod": null,
                            "outcome": {
                                "networkStatus": null,
                                "reason": "A PaymentIntent using type 'card' must be confirmed with either 'return_url' set to the desired URL or 'use_stripe_sdk' set to true (if using Stripe.js or the mobile SDKs). Please try confirming again in one of these two ways.",
                                "riskLevel": null,
                                "riskScore": null,
                                "type": "PAYMENT"
                            }
                        },
                        "paymentDetails": null,
                        "paymentTimeline": {
                            "overview": null,
                            "flows": null
                        },
                        "paymentConnections": null,
                        "paymentCustomer": null,
                        "paymentMethodDetails": {
                            "id": null,
                            "number": "**** **** **** 4242",
                            "expires": "06/2024",
                            "fingerprint": null,
                            "paymentMethod": "VISA",
                            "type": "CREDIT",
                            "product": "Visa Classic",
                            "issuingBank": null,
                            "category": null
                        },
                        "paymentReceipt": null,
                        "attachments": []
                    }
                },
                {
                    "cursor": "1",
                    "node": {
                        "id": "payments:af649684-d2a1-4e37-af42-e5b4e791caed",
                        "date": "2022-06-13T16:52:33Z",
                        "country": "USA",
                        "amount": {
                            "formattedAmount": "€18.24"
                        },
                        "status": "SUCCEEDED",
                        "paymentGateway": {
                            "id": "0268a1f6-c203-4697-bf6f-a90e261f0111",
                            "name": "Stripe",
                            "logo": "https://media.graphcms.com/output=format:jpg/resize=,width:59,height:59,fit:crop/9PSnk32nSg6ovnOkRgdr"
                        },
                        "paymentCore": {
                            "paymentMethod": "VISA",
                            "outcome": {
                                "networkStatus": "approved_by_network",
                                "reason": null,
                                "riskLevel": "NORMAL",
                                "riskScore": 37,
                                "type": "PAYMENT"
                            }
                        },
                        "paymentDetails": {
                            "statementDescriptor": "WHENTHEN",
                            "localCurrency": "USD",
                            "localAmount": {
                                "formattedAmount": "$18.87"
                            },
                            "exchangeRate": "1.03478",
                            "fee": {
                                "formattedAmount": "$0.85"
                            },
                            "tax": {
                                "formattedAmount": "$0.00"
                            },
                            "processingFee": {
                                "formattedAmount": "$0.85"
                            },
                            "net": {
                                "formattedAmount": "$18.02"
                            },
                            "description": null
                        },
                        "paymentTimeline": {
                            "overview": null,
                            "flows": null
                        },
                        "paymentConnections": {
                            "latestCharge": "2022-06-13T16:52:33Z",
                            "invoice": null,
                            "payout": null
                        },
                        "paymentCustomer": {
                            "id": "cus_LryrvZp8JdYjCY",
                            "email": null
                        },
                        "paymentMethodDetails": {
                            "id": "224c57fc-da40-4442-b062-7b4c9962d635",
                            "number": "**** **** **** 4242",
                            "expires": "06/2024",
                            "fingerprint": "OCv7RJjDQJE3VNvI",
                            "paymentMethod": "VISA",
                            "type": "CREDIT",
                            "product": "Visa Classic",
                            "issuingBank": null,
                            "category": null
                        },
                        "paymentReceipt": {
                            "type": "payment",
                            "message": null,
                            "date": "2022-06-13T16:52:33Z",
                            "receiptUrl": "https://pay.stripe.com/receipts/acct_1KTSlBHhXo8OToPM/ch_3LAGVBHhXo8OToPM0aEOpJB9/rcpt_Ls0WsEoJLjCUmakXamx5dYJoZ50KowS"
                        },
                        "attachments": []
                    }
                },
                {
                    "cursor": "1",
                    "node": {
                        "id": "payments:c1c151b9-00dd-4918-8937-4a47e9c94a4a",
                        "date": "2022-06-13T16:51:36Z",
                        "country": "USA",
                        "amount": {
                            "formattedAmount": "€15.82"
                        },
                        "status": "CANCELLED",
                        "paymentGateway": {
                            "id": "0268a1f6-c203-4697-bf6f-a90e261f0111",
                            "name": "Stripe",
                            "logo": "https://media.graphcms.com/output=format:jpg/resize=,width:59,height:59,fit:crop/9PSnk32nSg6ovnOkRgdr"
                        },
                        "paymentCore": {
                            "paymentMethod": "VISA",
                            "outcome": {
                                "networkStatus": "approved_by_network",
                                "reason": null,
                                "riskLevel": "NORMAL",
                                "riskScore": 45,
                                "type": "PAYMENT"
                            }
                        },
                        "paymentDetails": {
                            "statementDescriptor": "WHENTHEN",
                            "localCurrency": null,
                            "localAmount": null,
                            "exchangeRate": null,
                            "fee": {
                                "formattedAmount": "€0.00"
                            },
                            "tax": {
                                "formattedAmount": "€0.00"
                            },
                            "processingFee": {
                                "formattedAmount": "€0.00"
                            },
                            "net": {
                                "formattedAmount": "€0.00"
                            },
                            "description": null
                        },
                        "paymentTimeline": {
                            "overview": null,
                            "flows": null
                        },
                        "paymentConnections": {
                            "latestCharge": "2022-06-13T16:51:36Z",
                            "invoice": null,
                            "payout": null
                        },
                        "paymentCustomer": {
                            "id": "cus_LryrvZp8JdYjCY",
                            "email": null
                        },
                        "paymentMethodDetails": {
                            "id": "224c57fc-da40-4442-b062-7b4c9962d635",
                            "number": "**** **** **** 4242",
                            "expires": "06/2024",
                            "fingerprint": "OCv7RJjDQJE3VNvI",
                            "paymentMethod": "VISA",
                            "type": "CREDIT",
                            "product": "Visa Classic",
                            "issuingBank": null,
                            "category": null
                        },
                        "paymentReceipt": {
                            "type": "payment",
                            "message": null,
                            "date": "2022-06-13T16:51:36Z",
                            "receiptUrl": "https://pay.stripe.com/receipts/acct_1KTSlBHhXo8OToPM/ch_3LAGUFHhXo8OToPM0tyxa0Xp/rcpt_Ls0VXMssF7cGLsk9A8EQZqGmTHXCv9X"
                        },
                        "attachments": []
                    }
                },
                {
                    "cursor": "1",
                    "node": {
                        "id": "payments:8a44a9de-de79-484e-98c2-f50e2670fc24",
                        "date": "2022-06-13T16:41:41Z",
                        "country": "USA",
                        "amount": {
                            "formattedAmount": "€19.29"
                        },
                        "status": "SUCCEEDED",
                        "paymentGateway": {
                            "id": "0268a1f6-c203-4697-bf6f-a90e261f0111",
                            "name": "Stripe",
                            "logo": "https://media.graphcms.com/output=format:jpg/resize=,width:59,height:59,fit:crop/9PSnk32nSg6ovnOkRgdr"
                        },
                        "paymentCore": {
                            "paymentMethod": "VISA",
                            "outcome": {
                                "networkStatus": "approved_by_network",
                                "reason": null,
                                "riskLevel": "NORMAL",
                                "riskScore": 30,
                                "type": "PAYMENT"
                            }
                        },
                        "paymentDetails": {
                            "statementDescriptor": "WHENTHEN",
                            "localCurrency": "USD",
                            "localAmount": {
                                "formattedAmount": "$19.96"
                            },
                            "exchangeRate": "1.03478",
                            "fee": {
                                "formattedAmount": "$0.88"
                            },
                            "tax": {
                                "formattedAmount": "$0.00"
                            },
                            "processingFee": {
                                "formattedAmount": "$0.88"
                            },
                            "net": {
                                "formattedAmount": "$19.08"
                            },
                            "description": null
                        },
                        "paymentTimeline": {
                            "overview": null,
                            "flows": null
                        },
                        "paymentConnections": {
                            "latestCharge": "2022-06-13T16:41:41Z",
                            "invoice": null,
                            "payout": null
                        },
                        "paymentCustomer": {
                            "id": "cus_LryrvZp8JdYjCY",
                            "email": null
                        },
                        "paymentMethodDetails": {
                            "id": "224c57fc-da40-4442-b062-7b4c9962d635",
                            "number": "**** **** **** 4242",
                            "expires": "06/2024",
                            "fingerprint": "OCv7RJjDQJE3VNvI",
                            "paymentMethod": "VISA",
                            "type": "CREDIT",
                            "product": "Visa Classic",
                            "issuingBank": null,
                            "category": null
                        },
                        "paymentReceipt": {
                            "type": "payment",
                            "message": null,
                            "date": "2022-06-13T16:41:41Z",
                            "receiptUrl": "https://pay.stripe.com/receipts/acct_1KTSlBHhXo8OToPM/ch_3LAGKeHhXo8OToPM0LQiFGVo/rcpt_Ls0Lfxf5sh4EbEfy3eLm1yOC4waLUAc"
                        },
                        "attachments": []
                    }
                },
                {
                    "cursor": "1",
                    "node": {
                        "id": "payments:c01fbb84-2c41-4cdc-bd8d-37f6ed7771ae",
                        "date": "2022-06-13T15:25:40Z",
                        "country": "USA",
                        "amount": {
                            "formattedAmount": "€15.16"
                        },
                        "status": "CANCELLED",
                        "paymentGateway": {
                            "id": "0268a1f6-c203-4697-bf6f-a90e261f0111",
                            "name": "Stripe",
                            "logo": "https://media.graphcms.com/output=format:jpg/resize=,width:59,height:59,fit:crop/9PSnk32nSg6ovnOkRgdr"
                        },
                        "paymentCore": {
                            "paymentMethod": "VISA",
                            "outcome": {
                                "networkStatus": "approved_by_network",
                                "reason": null,
                                "riskLevel": "NORMAL",
                                "riskScore": 41,
                                "type": "PAYMENT"
                            }
                        },
                        "paymentDetails": {
                            "statementDescriptor": "WHENTHEN",
                            "localCurrency": null,
                            "localAmount": null,
                            "exchangeRate": null,
                            "fee": {
                                "formattedAmount": "€0.00"
                            },
                            "tax": {
                                "formattedAmount": "€0.00"
                            },
                            "processingFee": {
                                "formattedAmount": "€0.00"
                            },
                            "net": {
                                "formattedAmount": "€0.00"
                            },
                            "description": null
                        },
                        "paymentTimeline": {
                            "overview": null,
                            "flows": null
                        },
                        "paymentConnections": {
                            "latestCharge": "2022-06-13T15:25:40Z",
                            "invoice": null,
                            "payout": null
                        },
                        "paymentCustomer": {
                            "id": "cus_LryrvZp8JdYjCY",
                            "email": null
                        },
                        "paymentMethodDetails": {
                            "id": "224c57fc-da40-4442-b062-7b4c9962d635",
                            "number": "**** **** **** 4242",
                            "expires": "06/2024",
                            "fingerprint": "OCv7RJjDQJE3VNvI",
                            "paymentMethod": "VISA",
                            "type": "CREDIT",
                            "product": "Visa Classic",
                            "issuingBank": null,
                            "category": null
                        },
                        "paymentReceipt": {
                            "type": "payment",
                            "message": null,
                            "date": "2022-06-13T15:25:40Z",
                            "receiptUrl": "https://pay.stripe.com/receipts/acct_1KTSlBHhXo8OToPM/ch_3LAF95HhXo8OToPM16BEGfTb/rcpt_Lrz77V6gOREMxxPrDhEsI2aLK8ZvvR4"
                        },
                        "attachments": []
                    }
                },
                {
                    "cursor": "1",
                    "node": {
                        "id": "payments:d2773177-ad5c-4290-9ba4-53cd1b72354e",
                        "date": "2022-06-13T15:09:37Z",
                        "country": "USA",
                        "amount": {
                            "formattedAmount": "€12.97"
                        },
                        "status": "AUTHORISED",
                        "paymentGateway": {
                            "id": "0268a1f6-c203-4697-bf6f-a90e261f0111",
                            "name": "Stripe",
                            "logo": "https://media.graphcms.com/output=format:jpg/resize=,width:59,height:59,fit:crop/9PSnk32nSg6ovnOkRgdr"
                        },
                        "paymentCore": {
                            "paymentMethod": "VISA",
                            "outcome": {
                                "networkStatus": "approved_by_network",
                                "reason": null,
                                "riskLevel": "NORMAL",
                                "riskScore": 38,
                                "type": "PAYMENT"
                            }
                        },
                        "paymentDetails": {
                            "statementDescriptor": "WHENTHEN",
                            "localCurrency": null,
                            "localAmount": null,
                            "exchangeRate": null,
                            "fee": {
                                "formattedAmount": "€0.00"
                            },
                            "tax": {
                                "formattedAmount": "€0.00"
                            },
                            "processingFee": {
                                "formattedAmount": "€0.00"
                            },
                            "net": {
                                "formattedAmount": "€0.00"
                            },
                            "description": null
                        },
                        "paymentTimeline": null,
                        "paymentConnections": {
                            "latestCharge": "2022-06-13T15:09:37Z",
                            "invoice": null,
                            "payout": null
                        },
                        "paymentCustomer": {
                            "id": "cus_LryrvZp8JdYjCY",
                            "email": null
                        },
                        "paymentMethodDetails": {
                            "id": "pm_1LAEtXHhXo8OToPMOEghLAcL",
                            "number": "4242",
                            "expires": "06/2024",
                            "fingerprint": "OCv7RJjDQJE3VNvI",
                            "paymentMethod": "VISA",
                            "type": "CREDIT",
                            "product": null,
                            "issuingBank": null,
                            "category": null
                        },
                        "paymentReceipt": {
                            "type": "payment",
                            "message": null,
                            "date": "2022-06-13T15:09:37Z",
                            "receiptUrl": "https://pay.stripe.com/receipts/acct_1KTSlBHhXo8OToPM/ch_3LAEtYHhXo8OToPM1FR3MTrd/rcpt_LryrSnyW17SZIi3xy8Ahd8KFdASSbMh"
                        },
                        "attachments": []
                    }
                }
            ]
        }
    }
}
Private Key

Create a payment for a customer or payment method. The payment method will be authorised and return a status of AUTHORISED.

Use the capture API to capture the payment and return a status of SUCCEEDED .

You should provide a payment method token here to reduce PCI requirement. You will be eligible for the simplest method of PCI validation: SAQ A.

Idempotency

The Create a Headless Payment API supports Idempotency.

Request

ValueType
  • orderIdString

    An optional order id you can use for tracking

  • intentIdString

    If you are using Intent API, provide the id for an intent.

    This allows you to available of additional data points while creating an automation

  • currencyCodeString

    ISO 4217 Code e.g. EUR

  • amountLong

    Amount in minor units e.g. 5099 = 50.99

  • paymentMethodPaymentMethodDtoInput
  • paymentMethod.tokenString

    The token for the payment method.

    Only this field is needed to create a payment using a token.

    All other card fields can be ignored

  • paymentMethod.typeString

    e.g. CARD, APPLE_PAY, GOOGLE_PAY, PAYPAL, KLARNA

  • paymentMethod.walletTokenJSON

    The wallet token. When providing this, amount and currency are not needed.

  • paymentMethod.cardCardInputDto

    If you want to create a payment for a full card

  • paymentMethod.googlePayGooglePayInput

    Google Pay specific data

  • customerpaymentMethodCustomerDtoInput

    Customer to associate with a payment

  • customer.idString

    Customer id if you have previously created the customer

  • customer.emailString

    Customer email

  • customer.nameString

    Customer name

  • descriptionString

    A desc for the payment

  • metadataJSON

    Use this to store custom data about this payment

  • performHeadless3DSecureHeadlessThreeDSecureDtoInput

    3D Secure options

  • performHeadless3DSecure.redirectUrlString

    Redirect to the url indicated after customer finishes the 3D Secure authentication process

  • performHeadless3DSecure.perform3DSecureBoolean

    Explicitly request 3D Secure to take place for this payment

  • apmRedirectUrlString

    When performing a payment for an APM, this is the URL that we will redirect back to.

  • paymentProcessorConnectionIdString

    This is the ID in WhenThen of the payment processor you want to process the payment through.

  • fraudObject

    Pass fraud data from your custom fraud service provider.

CURL
curl
-X POST
-H "Content-Type: application/json"
-H "Authorization: Bearer xxxxxxx"
-d '{
	"query": "mutation authorizePayment($authorisePayment: AuthorisedPaymentInput!) {
    authorizePayment(authorisePayment: $authorisePayment) {
       id
       status
    }
  }",
	"variables": {
		"authorisePayment": {
			 "orderId": "557512fb-e5f3-45ce-9e60-b9418b92153b",
			 "flowId": "2d0fc623-f1ca-4051-b60a-7366ca14783c",
			 "intentId": "9106d9e7-87ba-4b39-9e99-599559aede60",
			 "amount": 100,
			 "currencyCode": "ISO 4217",
       "paymentMethod": {
        "type": "CARD",
        "token": "213dfsfd"
      },
			 "customer": {
				 "id": "1ba5d56b-f6d6-4170-b246-ca886d1e111f"
			 },
			 "description": ""
		}
	}
}'
https://api.whenthen.com/api/graphql

Response

ValueType
  • idID
    unique payment ID
  • sourceIdString
    identifier from gateway
  • orderIdString
    An optional order id you can use for tracking
  • connectionIdString
  • dateDateTime
    date and time, ISO format
  • statusPaymentStatus
  • amountAmount
    the payment amount, minor units
  • refundedAmountLong
    the total refunded payment amount, minor units
  • currencyString

    ISO 4217 Code e.g. EUR

  • countryString
  • eciString

    Electronic Commerce Indicator (ECI) is a value returned by Directory Servers (namely Visa, MasterCard, JCB, and American Express) indicating the outcome of authentication attempted on transactions enforced by 3DS

  • paymentProcessingOriginEnum

    AUTOMATION HEADLESS IMPORT

  • threeDSecureVersionString

    Version of 3DSecure being used for authentication

  • threeDSecureAuthenticationResultString

    Whether the authentication check was successful or not

  • paymentGatewayPaymentGateway
  • paymentGateway.nameString
    Gateway Name
  • paymentGateway.logoString
    Gateway Logo
  • paymentCorePaymentCore
  • paymentCore.processorStatusString
    Payment processor's status for the payment
  • paymentCore.paymentMethodPaymentMethod
  • paymentCore.outcomePaymentOutcome
  • paymentDetailsPaymentDetails
  • paymentDetails.statementDescriptorString
    what appears on customer statement
  • paymentDetails.localCurrencyString

    ISO 4217 Code e.g. EUR

  • paymentDetails.localAmountAmount
  • paymentDetails.exchangeRateString
  • paymentDetails.feeAmount
  • paymentDetails.taxAmount
  • paymentDetails.processingFeeAmount
  • paymentDetails.netAmount
  • paymentDetails.descriptionString
    A description for the payment processor or authorise api
  • paymentTimelinePaymentTimeline
  • paymentTimeline.overview[PaymentTimelineEvent]
    Collection/List of timeline events
  • paymentTimeline.flows[FlowSummary]
    Collection/List of flows
  • paymentCustomerPaymentCustomer
  • paymentCustomer.idString
    customer id
  • paymentCustomer.emailString
    customer email
  • paymentCustomer.nameString
    customer name
  • paymentMethodDetailsPaymentMethodDetails
  • paymentMethodDetails.idString
    payment method id
  • paymentMethodDetails.numberString
    masked .. or last four
  • paymentMethodDetails.expiresString
    Expiry date in MM/YYYY format
  • paymentMethodDetails.fingerprintString
  • paymentMethodDetails.paymentMethodPaymentMethod
  • paymentMethodDetails.typePaymentMethodCardtype
  • paymentMethodDetails.productString
    Payment card product
  • paymentMethodDetails.issuingBankString
  • paymentMethodDetails.categoryString
    Category of the card.
  • paymentMethodDetails.countryString
  • paymentMethodDetails.brandString
  • paymentMethodDetails.nameString
  • attachments[Attachment]
    Collection/List of attachments
  • attachments.idString
    id of attachment
  • attachments.fileNameString
    file name of attachment
  • attachments.objectKeyString
    object key for atachment
  • attachments.contenttypeString
    attachment content type
  • attachments.accessUrlString
    attachment url
JSON
{
   "id":"4a027d61-e645-478b-b7aa-91bf0cdd0d71",
   "date":"2022-09-14T20:58:05.387297Z",
   "country":"USA",
   "amount":{
      "formattedAmount":"€90.02"
   },
   "refundedAmount": null,
   "status":"SUCCEEDED",
   "paymentGateway":{
      "id":"0268a1f6-c203-4697-bf6f-a90e261f0222",
      "name":"Braintree",
      "logo":"https://media.graphcms.com/output=format:jpg/resize=,width:59,height:59,fit:crop/4N2n4aZ7SX6GIbaCS728"
   },
   "paymentCore":{
      "paymentMethod":"AMEX",
      "outcome":{
         "networkStatus":null,
         "reason":null,
         "riskLevel":null,
         "riskScore":null,
         "type":"PAYMENT"
      }
   },
   "paymentDetails":{
      "statementDescriptor":null,
      "localCurrency":"EUR",
      "localAmount":{
         "formattedAmount":"€90.02"
      },
      "exchangeRate":"null",
      "fee":null,
      "tax":null,
      "processingFee":null,
      "net":null,
      "description":null
   },
   "paymentTimeline":{
      "overview":null,
      "flows":null
   },
   "paymentConnections":{
      "latestCharge":"2022-02-28T10:36:51Z",
      "invoice":null,
      "payout":null
   },
   "paymentCustomer":{
      "id":"179644955",
      "email":"sduly1f@multiply.com"
   },
   "paymentMethodDetails":{
      "id":"dg4kg9g",
      "number":"0004",
      "expires":"06/2024",
      "fingerprint":null,
      "paymentMethod":"AMEX"
   },
   "paymentReceipt":null,
   "attachments":[

   ]
}

Status
  • AUTHORISED

    Payment authorised, ready to be captured

  • NEEDS_3D_SECURE

    Payment is waiting for 3D Secure before being authorised

  • SUCCEEDED

    Payment was successful

  • REFUNDED

    Payment was refunded

  • CANCELLED

    Payment was cancelled

  • FAILED

    Payment failed

  • DECLINED

    Payment was declined

  • DISPUTED

    Payment in dispute

Type
  • MASTERCARD

    Mastercard

  • PAYPAL

    Paypal

  • ACH

    Automated Clearing House (ACH) payments

  • ACCOUNT

    Account payments

  • WALLET

    Digital Wallet

  • CASH

    Cash

  • CRYPTO

    Crypto

  • VISA

    Visa

  • AMEX

    American Express

  • APPLE_PAY

    Apple Pay

  • GOOGLE_PAY

    Google Pay

  • UNKNOWN_CARD

    Unknown Card

  • BUY_NOW_PAY_LATER

    Buy now pay later

  • DIRECT_DEBIT

    Direct Debit

Type
  • PAYMENT
  • PAYOUT
  • TRANSFER

Name
  • INVALID_CVC
  • AUTHORIZATION_REQUIRED
  • CONTACT_CARD_ISSUER
  • UNSUPPORTED_CARD
  • UNSUPPORTED_CURRENCY
  • CARD_REJECTED
  • EXPIRED_CARD
  • SUSPECTED_FRAUD
  • GENERAL_DECLINE
  • INCORRECT_NUMBER
  • INCORRECT_PIN
  • INVALID_ADDRESS
  • INVALID_CARD_OR_ACCOUNT
  • INVALID_AMOUNT
  • INVALID_DATE
  • LOST_RESTRICTED_OR_STOLEN_CARD
  • BLOCKED_LIST
  • NOT_PERMITTED
  • OFFLINE_OR_ONLINE_PIN_REQUIRED
  • PIN_RETRY_EXCEEDED
  • PROCESSING_ERROR
  • WITHDRAWAL_COUNT_LIMIT_EXCEEDED
  • UNKNOWN

Name
  • rawAmount

    amount in minor units.

  • currency

    ISO 4217 Code e.g. EUR

  • formattedAmount

    formatted amount

Name
  • CREDIT

    Credit Card

  • DEBIT

    Debit Card

  • PREPAID

    Prepaid Card

  • UNDEFINED

    Undefined