Card testing

APICurrentLast updated: August 4th 2023, @ 3:10:00 am


Enter a rejection trigger in the First Name or Name on Card to simulate credit card error scenarios in advanced checkout integrations.

Note: Test using a Visa card number, such as 4012 8888 8888 1881, with a future expiration date and any 3-digit CVV.

Rejection triggers

Rejection test simulations show a response-code that changes based on the test trigger you use. Rejection trigger values are case-sensitive.

Note: All rejection scenarios return the AVS code as globally unavailable and the CVV code as not processed.

Test nameTriggerProcessor response codeCode description
Card refusedCCREJECT-REFUSED0500DO_NOT_HONOR
Fraudulent cardCCREJECT-SF9500SUSPECTED_FRAUD. Try using another card. Do not retry the same card.
Card expiredCCREJECT-EC5400EXPIRED_CARD
Luhn Check failsCCREJECT-IRC5180INVALID_OR_RESTRICTED_CARD. Try using another card. Do not retry the same card.
Insufficient fundsCCREJECT-IF5120INSUFFICIENT_FUNDS
Card lost, stolenCCREJECT-LS9520LOST_OR_STOLEN. Try using another card. Do not retry the same card.
Card not validCCREJECT-IA1330INVALID_ACCOUNT
Card is declinedCCREJECT-BANK_ERROR5100GENERIC_DECLINE
CVC check failsCCREJECT-CVV_F00N7CVV2_FAILURE_POSSIBLE_RETRY_WITH_CVV

Sample response

The response shows that the order is successfully created, but because a refusal was passed, the card payment status is DECLINED:

  • Line 18 shows status=DECLINED. The card was refused.
  • Line 51 shows avs_code=G. The card is globally unavailable.
  • Line 52 shows cvv_code=P. The card wasn't processed.
  • Line 53 shows response_code=5400. The card is expired.
1{
2 "id": "3M049991JF5624929",
3 "status": "COMPLETED",
4 "payment_source": {
5 "card": {
6 "last_digits": "6889",
7 "brand": "VISA",
8 "type": "CREDIT",
9 },
10 },
11 "purchase_units": [
12 {
13 "reference_id": "default",
14 "payments": {
15 "captures": [
16 {
17 "id": "2FB04508RA686960W",
18 "status": "DECLINED",
19 "amount": {
20 "currency_code": "USD",
21 "value": "500.00",
22 },
23 "final_capture": true,
24 "disbursement_mode": "INSTANT",
25 "seller_protection": { "status": "NOT_ELIGIBLE" },
26 "seller_receivable_breakdown": {
27 "gross_amount": { "currency_code": "USD", "value": "500.00" },
28 "paypal_fee": { "currency_code": "USD", "value": "13.44" },
29 "net_amount": { "currency_code": "USD", "value": "486.56" },
30 },
31 "links": [
32 {
33 "href": "https://api-m.sandbox.paypal.com/v2/payments/captures/2FB04508RA686960W",
34 "rel": "self",
35 "method": "GET",
36 },
37 {
38 "href": "https://api-m.sandbox.paypal.com/v2/payments/captures/2FB04508RA686960W/refund",
39 "rel": "refund",
40 "method": "POST",
41 },
42 {
43 "href": "https://api-m.sandbox.paypal.com/v2/checkout/orders/3M049991JF5624929",
44 "rel": "up",
45 "method": "GET",
46 },
47 ],
48 "create_time": "2022-08-09T22:20:05Z",
49 "update_time": "2022-08-09T22:20:05Z",
50 "processor_response": {
51 "avs_code": "G",
52 "cvv_code": "P",
53 "response_code": "5400",
54 },
55 },
56 ],
57 },
58 },
59 ],
60 "links": [
61 {
62 "href": "https://api-m.sandbox.paypal.com/v2/checkout/orders/3M049991JF5624929",
63 "rel": "self",
64 "method": "GET",
65 },
66 ],
67}

Processor response and error codes

To understand why a card payment was declined, review the Orders v2 processor response object in the Orders API response.

For more information about card payment decline reasons and possible values, see:

See also

Optional
Postman Collection

Test additional positive and 4xx error conditions.

Optional
Simulate negative responses

Use API request headers to trigger negative responses.

Optional
Error messages

Explore error messages supported by the Orders API.