PHP code example of kechankrisna / payway-partner

1. Go to this page and download the library: Download kechankrisna/payway-partner library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kechankrisna / payway-partner example snippets


use Kechankrisna\PaywayPartner\Model\RegisterMerchantRequest;
use Kechankrisna\PaywayPartner\PaywayPartner;
use Kechankrisna\PaywayPartner\PaywayPartnerService;

$payway = new PaywayPartnerService(new PaywayPartner(
    partnerName: 'your partner name',
    partnerId: 'partner id provided by ABA',
    partnerKey: getenv('ABA_PARTNER_KEY'),
    partnerPrivateKey: file_get_contents('/secure/partner-private.pem'),
    partnerPublicKey: file_get_contents('/secure/partner-public.pem'),
    partnerReferer: 'https://your-whitelisted-domain.com',
    baseApiUrl: PaywayPartner::SANDBOX_URL,
));

// 1. register, then redirect the merchant to the onboarding form
$response = $payway->registerMerchant(new RegisterMerchantRequest(
    pushbackUrl: 'https://your-domain.com/payway/pushback',
    redirectUrl: 'https://your-domain.com',
    registerRef: 'merchant-001',
    currency: 'USD',
));
if ($response->isSuccess()) {
    header('Location: ' . $response->url);
}

// 2. on your pushback_url: decrypt and store the merchant credentials
$credential = $payway->decryptPushback(file_get_contents('php://input'));