承接 payomatix/web-sdk 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

payomatix/web-sdk

最新稳定版本:1.2.5

Composer 安装命令:

composer require payomatix/web-sdk

包简介

Payomatix Web SDK for PHP

README 文档

README

Payomatix PHP SDK

This Payomatix PHP Library provides easy access to Payomatix APIs for php apps. It abstracts the complexity involved in direct integration and allows you to make quick calls to the APIs.

Table of Contents

  1. Requirements
  2. Dependencies
  3. Installation
  4. Initialization
  5. Getting Started
  6. Status
  7. Custom Request Timeouts
  8. Debugging Errors
  9. Terms and Conditions
  10. License
  11. References

Requirements

  1. Payomatix Merchant account with API Keys
  2. Minimum PHP versions: >= 7.0.0

Dependencies

The bindings require the following extensions in order to work properly:

If you use Composer, these dependencies should be handled automatically.

Installation

Installation via Composer.

To install the package via Composer, run the following command.

composer require payomatix/web-sdk

To use the bindings, use Composer's autoload:

require 'vendor/autoload.php';

Initialization

Create a .env file or copy from .env.example file Save your SECRET_KEY in the .env file as PAYOMATIX_SECRET_KEY

cp .env.example .env

Your .env file should look this.

PAYOMATIX_SECRET_KEY=PAYXXXXXXXXXXXXXXXX.XXXXXXSECKEY

Getting Started

The SDK provides two methods of making collections

  1. Payomatix Non-Seamless
  2. Payomatix Seamless

Simple usage for non-seamless payments looks like:

<?php

require_once 'vendor/autoload.php';

use Payomatix\Payomatix;

$payomatix = new Payomatix();

// customize curl timeouts
$payomatix->setOptions([
    'timeout' => 60
]);

$response = $payomatix->nonSeamlessPayment([
	'other_data' => [
	    'first_name' => 'your-name',
	    'last_name' => 'your-name',
	    'address' => 'address',
	    'state' => 'state',
	    'city' => 'city',
	    'zip' => '123456',
	    'country' => 'IN',
	    'phone_no' => '1234567890',
	    'card_no' => '4242424242424242',
	],
	'email' => 'test@jondoe.com',
	'amount' => '30.00',
	'currency' => 'USD',
	'merchant_ref' => 'ce35d90-fc2e-4a43-a900-1872d9c00890',
	'return_url' => 'https://mysite.com/redirect/dce35d90-fc2e-4a43-a900-1872d9c00890',
	'notify_url' => 'https://mysite.com/notify/ce35d90-fc2e-4a43-a900-1872d9c00890'
]);

if (isset($response['redirect_url']) && !empty($response['redirect_url'])) {
	header('Location: ' . $response['redirect_url']);
} else {
	print_r($response);
}

Same way, you can initiate seamless payments like:

<?php

require_once 'vendor/autoload.php';

use Payomatix\Payomatix;

$payomatix = new Payomatix();

$response = $payomatix->seamlessPayment([
	'first_name' => 'your-name',
	'last_name' => 'your-name',
	'address' => 'address',
	'country' => 'IN',
	'state' => 'state',
	'city' => 'city',
	'zip' => '123456',
	'phone_no' => '1234567890',
	'email' => 'test@jondoe.com',
	'amount' => '30.00',
	'currency' => 'INR',
	'return_url' => 'https://mysite.com/redirect/dce35d90-fc2e-4a43-a900-1872d9c00890',
	'notify_url' => 'https://mysite.com/notify/ce35d90-fc2e-4a43-a900-1872d9c00890',
	'merchant_ref' => 'ce35d90-fc2e-4a43-a900-1872d9c00890',
	'type_id' => '1',
	'card_no' => '4242424242424242',
	'ccexpiry_month' => '01',
	'ccexpiry_year' => '2029',
	'cvv_number' => '123'
]);

if (isset($response['redirect_url']) && !empty($response['redirect_url'])) {
	header('Location: ' . $response['redirect_url']);
} else {
	print_r($response);
}

Status

You can use the SDK to retrieve the status of transaction using merchant_ref or order_id as below:

<?php

require_once 'vendor/autoload.php';

use Payomatix\Payomatix;

$payomatix = new Payomatix();

$response = $payomatix->status([
	'merchant_ref' => 'ce35d90-fc2e-4a43-a900-1872d9c00890'
]);

if (isset($response['redirect_url']) && !empty($response['redirect_url'])) {
	header('Location: ' . $response['redirect_url']);
} else {
	print_r($response);
}

Custom Request Timeouts

By default PHP cURL request timeouts are set. To modify request timeouts (connect or total, in seconds) you'll need to tell the API client like this.

<?php

require_once 'vendor/autoload.php';

use Payomatix\Payomatix;

$payomatix = new Payomatix();

$payomatix->setOptions([
    'timeout' => 60,
    'connect_timeout' => 60,
    'ssl_verifyhost' => false
]);

Debugging Errors

We understand that you may run into some errors while integrating our library. You can contact our developer team for support.

For Authorization and Validation error responses, double-check your Secret key. If you get a server error, kindly engage the team for support.

Terms and Conditions

By using this library, you agree with our Terms and Conditions.

Copyright (c) Payomatix Inc.

License

This SDK is open-sourced software licensed under the MIT license.

Payomatix API References

统计信息

  • 总下载量: 18
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-12-12