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

When testing Primer's Transactions API, we have a special Primer Test Processor Connection which is ready for use on your Sandbox account when you first log in. We have a series of test tokens you can use with the Primer Test Processor to elicit a variety of status responses. Learn more about statuses in Managing transactions.
Environment | API | Dashboard |
---|---|---|
Sandbox | api.sandbox.primer.io | sandbox-dashboard.primer.io |
Testing authorization scenarios
Pass in a test token in the paymentMethod
field during authorization to test various transaction statuses.
Test Token | Scenario | Transaction Status |
---|---|---|
tok_auth_authorized_card | The 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_card | The transaction was declined by the processor, either at a gateway or acquirer level. | Declined |
tok_auth_failed_card | Primer failed to get a response from the chosen processor, it may be down or otherwise unavailable. | Failed |
tok_auth_settled_card | The 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.
Amount | Scenario | Risk Data Attribute in Response | Attribute Value |
---|---|---|---|
1-99 | AVS postal code check passed. | avsPostalCode | MATCHED |
100-199 | AVS postal code check failed. | avsPostalCode | NOT_MATCHED |
200-299 | AVS postal code check not supplied. No check performed. | avsPostalCode | NOT_PROVIDED |
300-399 | AVS street address check passed. | avsStreetAddress | MATCHED |
400-499 | AVS street address check failed. | avsStreetAddress | NOT_MATCHED |
500-599 | AVS street address check not supplied. No check performed. | avsStreetAddress | NOT_PROVIDED |
600-699 | CVV check passed. | cvv | MATCHED |
700-799 | CVV check failed. | cvv | NOT_MATCHED |
800-899 | CVV not supplied. No check performed. | cvv | NOT_PROVIDED |
Example usage:
1234567891011
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_PRIMER_TEST_PROCESSOR_MERCHANT_ID>"}'
curl
Scenarios
To test 3D secure, specify one of the values referenced below within the testScenario
field.
test scenario value | Scenario | 3D Secure Authorization Response | 3D Secure Verification Response On Challenge |
---|---|---|---|
3DS_V2_FRICTIONLESS_SUCCESS | 3DS v2 successful authentication without challenge | AUTH_SUCCESS | N/A |
3DS_V2_FRICTIONLESS_FAIL | 3DS v2 failed authentication without challenge | AUTH_FAILED | N/A |
3DS_V2_CHALLENGE_SUCCESS | 3DS v2 successful authentication after challenge | CHALLENGE | AUTH_SUCCESS |
3DS_V2_CHALLENGE_FAIL | 3DS v2 failed authentication after challenge | CHALLENGE | AUTH_FAILED |
3DS_V2_NOT_AVAILABLE | 3DS v2 skipped - not available from the issuer | SKIPPED | N/A |
3DS_V1_SUCCESS | 3DS v1 successful authentication | CHALLENGE | AUTH_SUCCESS |
3DS_V1_FAIL | 3DS v1 failed authentication | CHALLENGE | AUTH_FAILED |
3DS_V1_NOT_AVAILABLE | 3DS v1 skipped - not available from the issuer | SKIPPED | N/A |
Example usage:
12345678910111213141516171819202122232425262728293031323334
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 scenariotestScenario: '3DS_V2_CHALLENGE_SUCCESS',// Provide your order information as normalorder: myThreeDSOrderInfo,additionalInfo: moreCustomerInformation,},});/*** For Checkout Components, add the testScenario to the 3ds verify call:*/client.threeDSecure.verify({// choose a test scenariotestScenario: '3DS_V2_CHALLENGE_SUCCESS',// Provide your order information and token as normaltoken: myUnauthenticatedToken,order: myThreeDSOrderInfo,additionalInfo: moreCustomerInformation,})}
js