Set up the Forward API configuration
Forward API parameters
Your FlexCharge credentials
Retrieve your credentials from your Merchant Portal, and use them when setting up your configuration.
Forward request Variable | FlexCharge credential |
---|---|
$app_key-Flexcharge | Api Key |
$app_secret-Flexcharge | Api secret |
$FlexCharge_MID | Merchant id |
$tokenization_key-FlexCharge | Tokenization key |
This credential can be inserted as is in the body of your Forward request. | Site Id |
You can find credentials in at this place
Forward requests parameters
In order to send successful calls to FlexCharge API requests, you will need to provide the required parameters in the body of your Forward configuration.
Forward request parameters | Description | Example |
---|---|---|
$merchant_id | Your Braintree merchant id | |
$name | Name of the configuration | For Evaluate requests:flexcharge_evaluate For Transmit requests: flexcharge_transmit |
$url | Destination URL | For sandbox testing: https://api-sandbox.flex-charge.com/v1/ For production: <https://api.flex-charge.com/vl/> ---- Add /evaluate or /transmit according to your request |
$payment_method_nonce | Braintree payment method nonce to fetch payment details | |
$method | API method | Set to POST |
The types of API calls to forward
There are 2 API calls you will build for FlexCharge:
Name of Request | Purpose | Transactions to send | Description |
---|---|---|---|
Evaluate | Evaluation if a transaction can be rescued or not | Declined transactions | Contains Payment Method Token. Will return 'Approved', 'Declined' or 'Challenge' See complete documentation. |
Transmit | Risk model to improve rescue rate. | Approved transactions | Doesn't contain Payment Method token. Returns a 200 on success. See complete documentation. |
curl https://forwarding.sandbox.braintreegateway.com/ \
-H "Content-Type: application/json" \
-H "flexcharge-app-key: <FC_APP_KEY>" \
-H "flexcharge-app-secret: <FC_APP_SECRET>" \
-X POST \
-u "<BRAINTREE_PUBLIC_KEY>:<BRAINTREE_PRIVATE_KEY>" \
-d '{
"merchant_id": "<BRAINTREE_MERCHANT_ID>",
"payment_method_nonce": "fake-valid-nonce",
"name": "flexcharge_evaluate",
"url": "https://api-sandbox.flex-charge.com/v1/evaluate",
"method": "POST",
"override": {
"body": {
"transaction": {
"id": "3478613",
"timestampUtc": "0001-01-01T00:00:00Z",
"timezoneUtcOffset": 0,
"amount": 15000,
"currency": "USD",
"responseCode": "203",
"avsResultCode": "M",
"cvvResultCode": "NA",
"cavvResultCode": "2",
"responseCodeSource": "Braintree",
"responseDescription": "Activity limit exceeded",
"responseStatus": "DECLINED",
"transactionType": "CAPTURE",
"dynamicDescriptor": "MyShoesStore"
},
"payer": {
"id": "customer123",
"email": "[email protected]",
"phone": "+1 555-123-4567",
"birthdate": "1990-01-01"
},
"merchant": {
"country": "US",
"mcc": 5999,
"id": "merchant123",
"name": "Acme Inc."
},
"billingInformation": {
"firstName": "John",
"lastName": "Doenowitz",
"phone": "+1 555-123-4567",
"country": "United States",
"countryCode": "US",
"addressLine1": "123 Main St.",
"state": "CA",
"city": "San Francisco",
"zipcode": "94111"
},
"mid": "<FC_MID>",
"environment": "<FC_environment>",
"siteUrl": "https://www.someSite.com",
"orderSource": "ecommerce",
"siteId": "<FC_SITE_ID>",
"isDeclined": true,
"isMIT": false,
"orderId": "{enter a GUUID}",
"idempotencyKey": "{enter a GUUID}"
}
}'
curl https://forwarding.sandbox.braintreegateway.com/ \
-H "Content-Type: application/json" \
-H "flexcharge-app-key: <FC_APP_KEY>" \
-H "flexcharge-app-secret: <FC_SECRET_KEY>" \
-X POST \
-u "<BRAINTREE_PUBLIC_KEY>:<BRAINTREE_PRIVATE_KEY>" \
-d '{
"merchant_id": "<BRAINTREE_MERCHANT_ID>",
"payment_method_nonce": "fake-valid-nonce",
"name": "flexcharge_transmit",
"url": "https://api-sandbox.flex-charge.com/v1/transmit",
"method": "POST",
"override": {
"body": {
"transaction": {
"id": "3478613",
"timestampUtc": "0001-01-01T00:00:00Z",
"timezoneUtcOffset": 0,
"amount": 19975,
"currency": "USD",
"responseCode": "203",
"avsResultCode": "M",
"cvvResultCode": "NA",
"processorName": "Acme Payments",
"cavvResultCode": "2",
"responseCodeSource": "NMI",
"responseStatus": "DECLINED",
"transactionType": "CAPTURE"
},
"payer": {
"id": "customer123",
"email": "[email protected]"
},
"billingInformation": {
"firstName": "John",
"lastName": "Doenowitz",
"phone": "+1 555-123-4567",
"country": "United States",
"countryCode": "US",
"addressLine1": "123 Main St.",
"state": "CA",
"city": "San Francisco",
"zipcode": "94111"
},
"mid": "<FC_MID>",
"orderId": "{enter a GUUID}",
"isDeclined": false
}
}
}'
Testing scenarios
Transaction rescued by FlexCharge
Transaction was originally declined, then rescued by FlexCharge automatically.
Amount | Any amount over $10 and under $200. |
Name | Any. |
[email protected] (won't work without this email address) | |
Card | 4000002760003184 |
CVV | Any. |
Exp date | Any future date. Format must be MM / YYYY . |
Phone | Valid US phone number, complete with country code. |
Successful test results
- Transaction was sent over to FlexCharge
- The client side: Customer is redirected to success page
- Test transaction appears as successful on your CRM
Transaction that doesn't need FlexCharge
Test that your regular transactions are not affected by the widgets: run a successful transaction with your usual test card.
Successful test results
- Transaction was not sent over to FlexCharge
- Client side and Merchant's CRM behave as expected
That's it you're good to go!
Updated 10 days ago