# Alternative Payment Methods (Non-Credit Card) Tests

Non Credit Card orders include any alternative payment methods that can be used to pay partially or fully for an order including:

- Gift Card
- Store Credit
- Loyalty Points
- ApplePay
- AmazonPay
- AfterPay
- Affirm
- ShopRunner
- Klarna

Below is an outline of recommended testing and mapping for each of the payment methods.

## [Gift Card Orders](https://docs.forter.com/extensions/alternative-payment-methods-non-credit-card-tests#gift-card-orders) Gift Card Orders

### [Gift Card Mapping](https://docs.forter.com/extensions/alternative-payment-methods-non-credit-card-tests#gift-card-mapping) Gift Card Mapping

In order for our servers to correctly identify gift card orders, please send gift card as a payment instrument detail in the request. There should be a dedicated giftCard object payment array in the validation API documentation. The request should look something like:

```javascript
function ForterGiftCard(auth, gc) { // optional object for gift card purchases
    this.merchantPaymentId = gc.paymentTransaction.transactionID;
    this.value = {};
    this.value.currency = auth.currency_code;
    this.value.amountUSD = auth.amount.toString();
    this.value.amountLocalCurrency = auth.amount.toString();
}
```

### [Gift Card Testing](https://docs.forter.com/extensions/alternative-payment-methods-non-credit-card-tests#gift-card-testing) Gift Card Testing

- General test transaction: place an order using a valid test gift card and **ANY email address**
- Customer pays for entire order with gift card using the email address approve@forter.com
- Customer pays for entire order with gift card using the email address decline@forter.com
- Customer pays for entire order with gift card using the email address notreviewed@forter.com

## [Store Credit](https://docs.forter.com/extensions/alternative-payment-methods-non-credit-card-tests#store-credit) Store Credit

### [Store Credit Mapping](https://docs.forter.com/extensions/alternative-payment-methods-non-credit-card-tests#store-credit-mapping) Store Credit Mapping

Store Credit orders use an object identical to the gift card object formatting, please send store credit as a payment instrument detail in the request. There should be a dedicated giftCard object payment array in the validation API documentation. The request should look something like:

```javascript
function ForterStoreCredit(auth, sc) { // optional object for purchases made with store credit
    this.merchantPaymentId = sc.paymentTransaction.transactionID; // customized based on gateway
    this.value = {};
    this.value.currency = auth.currency_code; // customized based on gateway
    this.value.amountUSD = auth.amount.toString(); // customized based on gateway
    this.value.amountLocalCurrency = auth.amount.toString(); // customized based on gateway
}
```

### [Store Credit Testing](https://docs.forter.com/extensions/alternative-payment-methods-non-credit-card-tests#store-credit-testing) Store Credit Testing

- General test transaction: place an order using store credit and **ANY email address**
- Customer pays for entire order with store credit using the email address approve@forter.com
- Customer pays for entire order with store credit using the email address decline@forter.com
- Customer pays for entire order with store credit using the email address notreviewed@forter.com

## [Loyalty Points](https://docs.forter.com/extensions/alternative-payment-methods-non-credit-card-tests#loyalty-points) Loyalty Points

### [Loyalty Points Mapping](https://docs.forter.com/extensions/alternative-payment-methods-non-credit-card-tests#loyalty-points-mapping) Loyalty Points Mapping

```javascript
function ForterLoyalty(auth, loyalty) { // optional object for purchases made with loyalty points
    this.loyaltyPointsCount = sc.paymentTransaction.loyaltyValue; // customized based on gateway
    this.loyaltyPointsSource = account.pointsLocation; // optional
    this.merchantPaymentId = auth.loyaltyCode; // optional
}
```

### [Loyalty Points Testing](https://docs.forter.com/extensions/alternative-payment-methods-non-credit-card-tests#loyalty-points-testing) Loyalty Points Testing

- General test transaction: place an order using loyalty points and **ANY email address**
- Customer pays for entire order with store loyalty points using the email address approve@forter.com
- Customer pays for entire order with store loyalty points using the email address decline@forter.com
- Customer pays for entire order with store loyalty points using the email address notreviewed@forter.com

## [ApplePay](https://docs.forter.com/extensions/alternative-payment-methods-non-credit-card-tests#applepay) ApplePay

### [ApplePay Mapping](https://docs.forter.com/extensions/alternative-payment-methods-non-credit-card-tests#applepay-mapping) ApplePay Mapping

ApplePay orders leverage a tokenized card object. Please send ApplePay orders as a payment instrument detail in the request. There should be a dedicated applePay object within payment array in the validation API documentation. The request should look something like:

```javascript
function ForterApplePay(auth, ap) {
    var processorResponseCode = "";
    var processorResponseText = "";
    // format the expiration month. from 1 to 01, etc.
    if (ap.creditCardExpirationMonth.toString().length == 1) {
        var creditCardExpMonth = "0" + cc.creditCardExpirationMonth.toString();
    } else {
        var creditCardExpMonth = cc.creditCardExpirationMonth.toString();
    }
    this.nameOnCard = ap.creditCardHolder;
    this.cardBrand = ap.creditCardType;
    this.token = ap.token;
    this.lastFourDigits = ap.creditCardNumberLastDigits; // optional
    this.expirationMonth = creditCardExpMonth;
    this.expirationYear = cc.creditCardExpirationYear.toString();
    this.verificationResults = {};
    this.verificationResults.avsFullResult = auth.avs.toString(); // optional
    this.verificationResults.cvvResult = auth.cvd_code.toString(); // optional
    this.verificationResults.authorizationCode = auth.authorization_num.toString();
    processorResponseCode = auth.exact_resp_code.toString();
    processorResponseText = auth.exact_message.toString();
    this.verificationResults.processorResponseCode = processorResponseCode;
    this.verificationResults.processorResponseText = processorResponseText;
}
```

### [ApplePay Testing](https://docs.forter.com/extensions/alternative-payment-methods-non-credit-card-tests#applepay-testing) ApplePay Testing

- General test transaction: place an order using ApplePay and **ANY email address**
- Customer pays for order using ApplePay and the email address approve@forter.com
- Customer pays for order using ApplePay and the email address decline@forter.com
- Customer pays for order using ApplePay and the email address notreviewed@forter.com

## [Digital Wallets (e.g. AmazonPay, MetaPay)](https://docs.forter.com/extensions/alternative-payment-methods-non-credit-card-tests#digital-wallets-eg-amazonpay-metapay) Digital Wallets (e.g. AmazonPay, MetaPay)

### [Digital Wallet Mapping](https://docs.forter.com/extensions/alternative-payment-methods-non-credit-card-tests#digital-wallet-mapping) Digital Wallet Mapping

The Digital Wallet object includes any of the following payment methods:

- AmazonPay
- AliPay
- FacebookPay
- MetaPay
- Zelle
- WeChat Pay
- Mercado Pago
- UnionPay
- Payco
- Ame Digital
- KakaoPay
- Line Pay
- NaverPay
- MB Way

These orders use a digitalWallet method. Please send any of the above payment methods in the digitalWallet object and use one of the dedicated enums listed in our [Order v3](https://docs.forter.com/reference/order-v3 "Order v3") Documentation.

```javascript
function ForterDigitalWallet(auth) {
    this.digitalWalletName = "AMAZONPAY"; // select "AMAZONPAY" enum
    this.underlyingPaymentMethod.underlyingPaymentMethodName = "CREDITCARD"; // select from relevant enum UNKNOWN, CREDITCARD, BANKTRANSFER, CASH, BITCOIN
    this.paymentSuccessStatus = "Completed"; // gateway auth response
    this.digitalWalletPayerEmail = "john_s@test.com"; // email associated with digital wallet
    this.fullDigitalWalletResponsePayload = {}; // full response payload from digital wallet gateway
}
```

### [Digital Wallet Testing](https://docs.forter.com/extensions/alternative-payment-methods-non-credit-card-tests#digital-wallet-testing) Digital Wallet Testing

- General test transaction: place an order using applicable digital wallet and **ANY email address**
- Customer pays for order using AmazonPay (or applicable digital wallet) and email address approve@forter.com
- Customer pays for order using applicable digital wallet and email address decline@forter.com
- Customer pays for order using applicable digital wallet and email notreviewed@forter.com

## [AfterPay](https://docs.forter.com/extensions/alternative-payment-methods-non-credit-card-tests#afterpay) AfterPay

### [AfterPay Mapping](https://docs.forter.com/extensions/alternative-payment-methods-non-credit-card-tests#afterpay-mapping) AfterPay Mapping

Like AmazonPay, AfterPay orders use an installmentService method object which is mostly freeform but should still be a dedicated object. Please send AfterPay payment data in the GeneralPayment object as a payment instrument detail in the request.

```javascript
function ForterAffirm(auth) { // optional object for purchases made with Affirm
    this.name = "AfterPay Payment";
    this.payload = {}; // any additional raw response data
}
```

### [Affirm Testing](https://docs.forter.com/extensions/alternative-payment-methods-non-credit-card-tests#affirm-testing) Affirm Testing

- General test transaction: place an order using AfterPay account and **ANY email address**
- Customer pays for order using AfterPay and email address approve@forter.com
- Customer pays for order using AfterPay and email address decline@forter.com
- Customer pays for order using AfterPay and email notreviewed@forter.com

Note that by default, AfterPay payments will show as **General Payment method** in the Detailed transaction view and Forter will not decision these transactions (i.e. return a not reviewed decision). AfterPay typically provides its own coverage and fraud detection for payments with this method. However, if you would like decisions on this payment method, please contact your onboarding analyst.

## [Affirm](https://docs.forter.com/extensions/alternative-payment-methods-non-credit-card-tests#affirm) Affirm

### [Affirm Mapping](https://docs.forter.com/extensions/alternative-payment-methods-non-credit-card-tests#affirm-mapping) Affirm Mapping

Affirm orders use a generalPayment method object which is mostly freeform but should still be a dedicated object. Please send Affirm in the GeneralPayment object as a payment instrument detail in the request.

```javascript
function ForterAffirm(auth) { // optional object for purchases made with Affirm
    this.name = "Affirm Payment";
    this.payload = {}; // any additional raw response data
}
```

### [Affirm Testing](https://docs.forter.com/extensions/alternative-payment-methods-non-credit-card-tests#affirm-testing-1) Affirm Testing

- General test transaction: place an order using AmazonPay account and **ANY email address**
- Customer pays for order using AmazonPay and email address approve@forter.com
- Customer pays for order using AmazonPay and email address decline@forter.com
- Customer pays for order using AmazonPay and email notreviewed@forter.com

Note that by default, Affirm payments will show as **General Payment method** in the Detailed transaction view and Forter will not decision these transactions (i.e. return a not reviewed decision). If you would like decisions on this payment method, please contact your onboarding analyst.

## [ShopRunner](https://docs.forter.com/extensions/alternative-payment-methods-non-credit-card-tests#shoprunner) ShopRunner

### [Shoprunner Mapping](https://docs.forter.com/extensions/alternative-payment-methods-non-credit-card-tests#shoprunner-mapping) Shoprunner Mapping

ShopRunner orders can leverage either the existing creditCard object or tokenizedCard object. Depending on the authorization data you have available, these should be mapped to either the tokenizedCard or creditCard payment instrument detail in the request. The below example request uses the tokenizedCard mapping:

```javascript
function ShopRunner(auth, cc) {
    var processorResponseCode = "";
    var processorResponseText = "";
    // format the expiration month. from 1 to 01, etc.
    if (ap.creditCardExpirationMonth.toString().length == 1) {
        var creditCardExpMonth = "0" + cc.creditCardExpirationMonth.toString();
    } else {
        var creditCardExpMonth = cc.creditCardExpirationMonth.toString();
    }
    this.nameOnCard = cc.creditCardHolder;
    this.cardBrand = cc.creditCardType;
    this.token = cc.token;
    this.lastFourDigits = cc.creditCardNumberLastDigits;
    this.expirationMonth = cc.creditCardExpMonth;
    this.expirationYear = cc.creditCardExpirationYear.toString();
    this.verificationResults = {};
    this.verificationResults.avsFullResult = auth.avs.toString(); // optional
    this.verificationResults.cvvResult = auth.cvd_code.toString(); // optional
    this.verificationResults.authorizationCode = auth.authorization_num.toString();
    processorResponseCode = auth.exact_resp_code.toString();
    processorResponseText = auth.exact_message.toString();
    this.verificationResults.processorResponseCode = processorResponseCode;
    this.verificationResults.processorResponseText = processorResponseText;
    this.paymentGatewayData = {};
    this.paymentGatewayData.gatewayName = "FIRSTDATA_CREDIT"; // adjust based on your processor
    this.paymentGatewayData.gatewayTransactionId = auth.retrieval_ref_no.toString();
}
```
