gingerpayments/ginger-plugin-sdk

Extra layer for ginger-php library to use in plugin development.

1.5.2 2024-03-07 10:59 UTC

This package is auto-updated.

Last update: 2024-12-05 09:26:04 UTC


README

This library is custom developed for Ginger API, based on schemas from API.
Should be used with payment plugins or for order creation.

Available functionality :

  • Creation Order entity with all related entities.
  • Post the new order to Ginger API.

Overview :

Entities Overview

Transactions

This entity contains several single transactions, basically no more than 1 transaction.

  • To initialize new object :
$transactions = new Transactions(
    new Transaction(...)
);
  • To add new transaction :
$transactions->addTransaction($transaction);
  • To remove transaction by index :
$transactions->removeTransaction($index);

Transaction

This entity contains general payment information. You should use this entity to tell the API how to process your request.

  • To initialize new object :
$transaction = new Transaction(
    paymentMethod: "apple-pay"
);
  • To add Payment Method Details there is two ways :

    • While initializing
    $transaction = new Transaction(
      paymentMethod: "ideal",
      paymentMethodDetails: new PaymentMethodDetails(...)
    );  
    • Through std object exemplar, in way of expanding its properties (for now only with prepared for payment methods).
    $transaction->getPaymentMethodDetails()->setPaymentMethodDetailsIdeal();
  • To receive a Payment Method Details :

$transaction->getPaymentMethodDetails();

Payment Method

This field should be used to store payment name.

Payment Method Details

This entity contains additional payload for payment method, such as issuer id, hosted fields data
or data for recurring payments.

  • For now, only string types of attributes values are supported.