PHP code example of iodigital / peachpayment

1. Go to this page and download the library: Download iodigital/peachpayment 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/ */

    

iodigital / peachpayment example snippets


$client = (new PeachPayment())->initServerToServer();
// or
$client = (new PeachPayment())->initCopyAndPay();

$client = (new PeachPayment())->initServerToServer($settings);

registerCard(CardBuilder $card);
registerCardDuringPayment(CardBuilder $card);
repeatedPayment(PaymentCard $card, $owner, int $amount, string $type = PaymentScheme::REPEATED_PAYMENT);
oneClickPayment(PaymentCard $card, int $amount);
paymentStatus(string $paymentId);
deleteCard(string $registrationId);

// Available options for $type in repeatedPayment()
PaymentScheme::INITIAL_PAYMENT;
PaymentScheme::REPEATED_PAYMENT;

prepareCheckout(int $amount);
getCheckoutRegistrationResult($checkoutId);
registerCard();
registerCardDuringPayment(int $amount);
repeatedPayment(PaymentCard $card, $owner, int $amount, string $type = PaymentScheme::REPEATED_PAYMENT);
paymentStatus(string $checkoutId);

$response = new \IoDigital\PeachPayment\Api\Response();
$response->isSuccessfulResponse($resultCode); // true|false
$response->isValidationError($resultCode); // true|false

protected $except = [
        config('peachpayment.webhook_url')
    ];

$settings = new Setting();
$settings->setUser('lorem')
         ->setPassword('ipsum')
         ->setEntityIdOnceOff('dolor');

$pay = (PeachPayment())->initServerToServer($settings);