Test your integration

Test your front-end payment flows, and transaction lifecycle requests.

Testing the Transactions API

When testing Primer's Transactions API, we have a series of test tokens to elicit a variety of status responses. Learn more about statuses in Managing transactions.

Testing authorization scenarios

Pass in a test token in the paymentMethod field during authorization to test various transaction statuses.

Test TokenScenarioTransaction Status
tok_auth_authorized_cardThe transaction was authorized by the processor. This will put the transaction into an authorized state if using authorization only, or a settling state if using auth and capture.
Authorized

or
Settling
tok_auth_declined_cardThe transaction was declined by the processor, either at a gateway or acquirer level.
Declined
tok_auth_failed_cardPrimer failed to get a response from the chosen processor, it may be down or otherwise unavailable.
Failed
tok_auth_settled_cardThe transaction was authorized and subsequently settled by the processor.
Settled

Testing AVS and CVV scenarios

Use the amount field to test different AVS and CVV check scenarios.

AmountScenarioRisk Data Attribute in ResponseAttribute Value
1-99AVS postal code check passed.avsPostalCodeMATCHED
100-199AVS postal code check failed.avsPostalCodeNOT_MATCHED
200-299AVS postal code check not supplied. No check performed.avsPostalCodeNOT_PROVIDED
300-399AVS street address check passed.avsStreetAddressMATCHED
400-499AVS street address check failed.avsStreetAddressNOT_MATCHED
500-599AVS street address check not supplied. No check performed.avsStreetAddressNOT_PROVIDED
600-699CVV check passed.cvvMATCHED
700-799CVV check failed.cvvNOT_MATCHED
800-899CVV not supplied. No check performed.cvvNOT_PROVIDED

Example usage:

1
2
3
4
5
6
7
8
9
10
11
curl --location --request \
POST 'https://api.sandbox.primer.io/transactions/auth' \
--header 'X-API-KEY: <YOUR_API_KEY>' \
--header 'IDEMPOTENCY_KEY: order-123' \
--data '{
"paymentMethod": "tok_lifecycle_success", # use a test token here
"orderId": "order-123",
"amount": 700, # use a test amount here
"currencyCode": "EUR",
"merchantId": "<YOUR_MERCHANT_ID>"
}'
curl

Testing 3D Secure

Scenarios

To test 3D secure, specify one of the values referenced below within the testScenario field.

test scenario valueScenario3D Secure Authorization Response3D Secure Verification Response On Challenge
3DS_V2_FRICTIONLESS_SUCCESS3DS v2 successful authentication without challengeAUTH_SUCCESSN/A
3DS_V2_FRICTIONLESS_FAIL3DS v2 failed authentication without challengeAUTH_FAILEDN/A
3DS_V2_CHALLENGE_SUCCESS3DS v2 successful authentication after challengeCHALLENGEAUTH_SUCCESS
3DS_V2_CHALLENGE_FAIL3DS v2 failed authentication after challengeCHALLENGEAUTH_FAILED
3DS_V2_NOT_AVAILABLE3DS v2 skipped - not available from the issuerSKIPPEDN/A
3DS_V1_SUCCESS3DS v1 successful authenticationCHALLENGEAUTH_SUCCESS
3DS_V1_FAIL3DS v1 failed authenticationCHALLENGEAUTH_FAILED
3DS_V1_NOT_AVAILABLE3DS v1 skipped - not available from the issuerSKIPPEDN/A

Example usage:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
async function onWindowLoaded() {
const client = new Primer({
credentials: { clientToken: '<YOUR_CLIENT_TOKEN>' },
});
/**
* For Universal Checkout, add testScenario to the threeDSecure options:
*/
client.checkout({
container: '#checkout-container',
threeDSecure: {
// choose a test scenario
testScenario: '3DS_V2_CHALLENGE_SUCCESS',
// Provide your order information as normal
order: myThreeDSOrderInfo,
additionalInfo: moreCustomerInformation,
},
});
/**
* For Checkout Components, add the testScenario to the 3ds verify call:
*/
client.threeDSecure.verify({
// choose a test scenario
testScenario: '3DS_V2_CHALLENGE_SUCCESS',
// Provide your order information and token as normal
token: myUnauthenticatedToken,
order: myThreeDSOrderInfo,
additionalInfo: moreCustomerInformation,
})
}
js