It's easy to store credit card in PayWay and create payment using that that credit card token.
PayWay Rest API: Check if Rest API credentials are valid
PayWay Rest API: Create Customer Create Token
Below is a PHP script to create payment using stored credit card token:
Output as below:
PayWay Rest API: Check if Rest API credentials are valid
PayWay Rest API: Create Customer Create Token
Below is a PHP script to create payment using stored credit card token:
<?php include_once "CurlExecutor.php"; define("BASE_URL", "https://api.payway.com.au/rest/v1"); define("MERCHANT_ID", "TEST"); define("PRIVATE_KEY", "T10487_SEC_..."); define("PUBLIC_KEY", "T10487_PUB_..."); createTokenPayment(); function createTokenPayment() { $headers[] = "Authorization: Basic " . base64_encode(PRIVATE_KEY . ":"); $headers[] = "Content-Type: application/x-www-form-urlencoded"; $post = array( "customerNumber" => 7, "merchantId" => MERCHANT_ID, "transactionType" => "payment", "principalAmount" => "23.45", "currency" => "aud", "orderNumber" => "Sale-Identification" ); $result = CurlExecutor::execute(BASE_URL . "/transactions", "POST", $post, null, $headers); $result["response"] = json_decode($result["response"]); CurlExecutor::prettyPrint($result); } ?>
Output as below:
Array ( [code] => 201 [response] => stdClass Object ( [transactionId] => 1957977083 [receiptNumber] => 1957977083 [status] => approved [responseCode] => 08 [responseText] => Honour with identification [transactionType] => payment [customerNumber] => 7 [customerName] => Pritom [customerEmail] => pritomkucse@gmail.com [orderNumber] => Sale-Identification [currency] => aud [principalAmount] => 23.45 [surchargeAmount] => 0 [paymentAmount] => 23.45 [paymentMethod] => creditCard [creditCard] => stdClass Object ( [cardNumber] => 516320...008 [expiryDateMonth] => 08 [expiryDateYear] => 20 [cardScheme] => mastercard [cardholderName] => My Mastercard ) [merchant] => stdClass Object ( [merchantId] => TEST [merchantName] => Test Merchant [links] => Array ( [0] => stdClass Object ( [rel] => self [href] => https://api.payway.com.au/rest/v1/merchants/TEST ) ) ) [transactionDateTime] => 10 Jun 2017 13:09 AEST [settlementDate] => 10 Jun 2017 [isVoidable] => 1 [isRefundable] => [links] => Array ( [0] => stdClass Object ( [rel] => self [href] => https://api.payway.com.au/rest/v1/transactions/1957977083 ) [1] => stdClass Object ( [rel] => void [href] => https://api.payway.com.au/transactions/1957977083/void ) ) ) )