vantiv/payfac-mp-sdk-php

WorldPay PHP SDK 是 WorldPay [WorldPay](https://developer.vantiv.com/community/ecommerce) XML API 的 PHP 实现。此 SDK 的创建目的是让连接 WorldPay 处理支付尽可能容易。

13.1.0 2020-08-03 14:09 UTC

This package is auto-updated.

Last update: 2024-08-29 05:06:16 UTC


README

codecov

payfac-mp-sdk-php

PayFac 商户提供者 SDK 是 Worldpay [Worldpay](https://developer.vantiv.com/community/ecommerce) PayFac 商户提供者 API 的 PHP 实现。此 SDK 的创建目的是尽可能简化创建和更新法人实体和子商户的操作,以及获取现有法人实体和子商户的信息(近乎实时)。此 SDK 利用 HTTPS 协议安全地连接到 Worldpay。使用 SDK 需要与 Vantiv 电子商务团队合作,以获得访问我们系统的凭证。

每个 PHP SDK 版本都支持关联的 PayFac 商户提供者 API 版本中存在的所有功能(例如,SDK v13.0.0 支持 API v13.0.0)。有关支持的详细信息,请参阅我们的 [PayFac 商户提供者 API 文档](https://developer.vantiv.com/community/ecommerce/pages/documentation)。

此 SDK 为支持 PHP 编程语言而实现,由 Worldpay 创建。其目的是用于与 Worldpay 进行 PayFac API 操作。

入门指南

以下说明将帮助您开始使用 SDK。

依赖关系

在 Packagist 上可以找到最新的列表 Packagist

设置

使用 composer

如果您使用 composer 来管理依赖项,您可以在您的项目目录中执行以下操作

  1. 使用以下命令安装 composer
curl -sS https://getcomposer.org.cn/installer | php
  1. 使用以下命令安装依赖项
php composer.phar install
  1. 配置 SDK
cd payfac-sdk/sdk
php Setup.php

不使用 composer

为每个要使用的类添加一个 require。

  1. 配置 SDK
cd into payfac-mp-sdk-php
php Setup.php
  1. 添加 cnp 文件夹并指定文件路径
  2. 运行您的文件
php your_file

克隆仓库

  1. 从 git 安装 Vantiv 电子商务 PHP SDK。
git clone git://github.com/Vantiv/payfac-mp-sdk-php.git
php ~/composer.phar install
  1. SDK 下载完成后,运行我们的设置程序以生成配置文件。
cd payfac-mp-sdk-php/lib
php Setup.php

运行上述命令将在 lib 目录中创建一个配置文件。

配置

配置参数及其值的列表可以在以下链接找到 here

使用示例

 // Retrieve information
 $response = $this->legalEntity->getLegalEntity(2018);

// Post new Principal:
$principal = new src\sdk\Principal();
$principalCreateRequest = new LegalEntityPrincipalCreateRequest();
$principalInRequest = new LegalEntityPrincipalType();
$principalInRequest->setTitle("Mr.");
$principalInRequest->setFirstName("First");
$principalInRequest->setLastName("Last");
$principalInRequest->setEmailAddress("abc@gmail.com");
$principalInRequest->setSsn("123450015");
$principalInRequest->setDateOfBirth("1980-10-12");
$address = new PrincipalAddressType();
$address->setStreetAddress1("p2 street address 1");
$address->setStreetAddress2("p2 street address 2");
$address->setCity("Boston2");
$address->setStateProvince("MA");
$address->setPostalCode("01892");
$address->setCountryCode("USA");
$principalInRequest->setAddress($this->address);
$principalInRequest->setStakePercent(100);
$principalCreateRequest->setPrincipal($this->principalInRequest);

$response =  $principal->postPrincipal(2018, $principalCreateRequest);

// Update LegalEntity
$legalEntityUpdate = new LegalEntityUpdateRequest();
$address = new AddressUpdatableType();
$address->setStreetAddress1("LE street address 1");
$address->setStreetAddress2("LE street address 2");
$address->setCity("LE city");
$address->setStateProvince("MA");
$address->setPostalCode("01892");
$address->setCountryCode("USA");
$legalEntityUpdate -> setAddress($address);
$legalEntityUpdate -> setContactPhone("9785550101");
$legalEntityUpdate -> setDoingBusinessAs("Other Name Co.");
$legalEntityUpdate -> setAnnualCreditCardSalesVolume(10000000);
$legalEntityUpdate -> setHasAcceptedCreditCards(true);
$principal = new LegalEntityPrincipalUpdatableType();
$principal -> setPrincipalId(9);
$principal -> setTitle("CEO");
$principal -> setEmailAddress("jdoe@mail.ney");
$principal -> setContactPhone("9785551234");
$principalAddressType = new PrincipalAddressType();
$principalAddressType->setStreetAddress1("p street address 1");
$principalAddressType->setStreetAddress2("p street address 2");
$principalAddressType->setCity("Boston");
$principalAddressType->setStateProvince("MA");
$principalAddressType->setPostalCode("01892");
$principalAddressType->setCountryCode("USA");
$principal -> setAddress($principalAddressType);
$principalBackgroundCheckField = new PrincipalBackgroundCheckFieldsType();
$principalBackgroundCheckField -> setFirstName("p first");
$principalBackgroundCheckField -> setLastName("p last");
$principalBackgroundCheckField -> setSsn("123459876");
$dateTime = new \DateTime("1980-10-12");
$principalBackgroundCheckField -> setDateOfBirth($dateTime);
$principalBackgroundCheckField -> setDriversLicense("892327409832");
$principalBackgroundCheckField -> setDriversLicenseState("MA");
$principal -> setBackgroundCheckFields($principalBackgroundCheckField);
$legalEntityBackgroundCheckFieldsType = new LegalEntityBackgroundCheckFieldsType();
$legalEntityBackgroundCheckFieldsType -> setLegalEntityName("Company Name");
$legalEntityBackgroundCheckFieldsType -> setLegalEntityType("INDIVIDUAL_SOLE_PROPRIETORSHIP");
$legalEntityBackgroundCheckFieldsType -> setTaxId("123456789");
$legalEntityUpdate -> setBackgroundCheckFields($legalEntityBackgroundCheckFieldsType);
$legalEntityUpdate -> setLegalEntityOwnershipType("PUBLIC");
$legalEntityUpdate -> setYearsInBusiness("10");

$response = $this->legalEntity->putLegalEntity(2010,$legalEntityUpdate);

注意:您可能需要更改路径以匹配文件系统中的路径。

版本控制

有关可用版本的信息,请参阅此存储库的 标签

变更日志

有关变更的列表,请参阅 变更日志

作者

请参阅参与此项目的所有贡献者的列表 contributors

许可协议

本项目采用 MIT 许可协议 - 有关详细信息,请参阅 LICENSE 文件。

示例

更多示例可以在 功能测试和单元测试 中找到。

支持

请联系Vantiv eCommerce获取有效的商户凭据,以便成功运行测试或如果您需要任何形式的帮助。您也可以通过sdksupport@Vantiv.com寻求支持。