Follow

E-Commerce and Phone Orders

Use this for E-Commerce or phone orders where you need to manually enter a card number.

Processing a Keyed Card Example

This tutorial will outline how to process keyed credit/debit cards through our REST Api. Generally, keyed transactions come from e-commerce, phone or mail orders. Keyed transactions should only be run if the customer is not present with their card. If the card is available, then you should process a swiped transaction, preferably via an EMV capable PayJunction Smart Terminal. Swiping cards will lower the credit card processing fees and reduce your risk. 

Production Request

curl -X POST -u "login:password" -H "Accept: application/json" -H "X-PJ-Application-Key: YOUR_PRODUCTION_APP_KEY" \
    -d "action=CHARGE" \
    -d "cardNumber=4444333322221111" \
    -d "cardExpMonth=01" \
    -d "cardExpYear=2020" \
    -d "amountBase=3.00" \
    "https://api.payjunction.com/transactions"

Response

{
    "transactionId": 15572,
    "uri": "https://api.payjunction.com/transactions/15572",
    "terminalId": 1,
    "action": "CHARGE",
    "amountBase": "3.00",
    "amountTotal": "3.00",
    "status": "CAPTURE",
    "created": "2014-01-22T21:38:25Z",
    "lastModified": "2014-01-22T21:38:25Z",
    "response": {
         "approved": true,
        "code": "00",
        "message": "Approved",
        "processor": {
            "authorized": true,
            "approvalCode": "PJ20AP",
            "avs": {
                "status": "NOT_REQUESTED"
            },
            "cvv": {
                "status": "NOT_REQUESTED"
            }
        }
    },
    "settlement": {
        "settled": false
    },
    "vault": {
        "type": "CARD",
        "accountType": "VISA",
        "lastFour": "1111"
    }
}

This is the most basic example of running a card. Most developers only want to check if the card was approved or declined. See the highlighted “approved” boolean in the JSON response. Simply check this and continue coding your application. 

Related Articles & Resources

Transaction REST API specification

Developer sandbox and test account