gingerpayments/ginger-plugin-sdk

为ginger-php库提供的额外层,用于插件开发。

1.5.2 2024-03-07 10:59 UTC

This package is auto-updated.

Last update: 2024-09-05 08:55:39 UTC


README

这个库是基于API模式定制的,用于Ginger API。
应与支付插件或订单创建一起使用。

可用功能

  • 创建包含所有相关实体的订单实体。
  • 将新订单发布到Ginger API。

概述

实体概述

  • 交易
  • 描述
  • 金额
  • 客户
    • 出生日期
    • 地址
      • 国家
  • 订单行
  • 额外
  • 客户端

交易

此实体包含多个单独的交易,基本上不超过1个交易。

  • 初始化新对象
$transactions = new Transactions(
    new Transaction(...)
);
  • 添加新交易
$transactions->addTransaction($transaction);
  • 按索引移除交易
$transactions->removeTransaction($index);

交易

此实体包含一般支付信息。您应使用此实体来告诉API如何处理您的请求。

  • 初始化新对象
$transaction = new Transaction(
    paymentMethod: "apple-pay"
);
  • 添加支付方式详情有两种方式

    • 在初始化时
    $transaction = new Transaction(
      paymentMethod: "ideal",
      paymentMethodDetails: new PaymentMethodDetails(...)
    );  
    • 通过标准对象示例,通过扩展其属性(目前仅支持支付方式)。
    $transaction->getPaymentMethodDetails()->setPaymentMethodDetailsIdeal();
  • 接收支付方式详情

$transaction->getPaymentMethodDetails();

支付方式

此字段应用于存储支付名称。

支付方式详情

此实体包含支付方式的附加有效负载,例如发行商ID、托管字段数据
或周期性支付的数据。

  • 目前,仅支持字符串类型的属性值。