承接 ipaymu/ipaymu-php-api 相关项目开发

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

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

ipaymu/ipaymu-php-api

Composer 安装命令:

composer require ipaymu/ipaymu-php-api

包简介

iPaymu PHP API Package Library

README 文档

README

The Official iPaymu-php-api

Latest Stable Version Total Downloads Latest Unstable Version License

This is the Official PHP wrapper/library for iPaymu Payment API, that is compatible with Composer. Visit https://ipaymu.com for more information about the product and see documentation at https://ipaymu.com/en/api-documentation/ for more technical details.

Free signup here https://my.ipaymu.com/members/signup.htm to accept payment online now!

Installation

The best way to use this package is using composer

composer require ipaymu/ipaymu-php-api

Usage

Requirement

First, get your apikey & va number from iPaymu dashboard.

Initialization

<?php
use iPaymu\iPaymu;

$apiKey = 'your-apikey';
$va = 'your-va';
$production = true;

$iPaymu = new iPaymu($apiKey, $va, $production);

General

Check Balance

$balance = $iPaymu->checkBalance();

Check Transaction

$status = $iPaymu->checkTransaction($id);

Set URL

$iPaymu->setURL([
    'ureturn' => 'https://your-website/thankyou_page',
    'unotify' => 'https://your-website/notify_page',
    'ucancel' => 'https://your-website/cancel_page',
]);

Set Buyer

$buyer = $iPaymu->setBuyer([
    'name' => 'your-name',
    'phone' => 'your-phone',
    'email' => 'your-email',
]);

Payment

There are 2 payment methods: Payment Direct & Payment Redirect, with the following parameters:

paymentMethod
  • va => Virtual Account
  • banktransfer => Transfer Bank
  • cstore => Convenience Store
  • cod => Cash on Delivery
  • qris => QRIS

paymentChannel

va
  • bag => Bank Artha Graha
  • bca => Bank Central ASIA
  • bni => Bank Negara Indonesia
  • cimb => Bank Cimb Niaga
  • mandiri => Bank Mandiri
  • bmi => Bank Muamalat Indonesia
  • bri => Bank Rakyat Indonesia
  • bsi => Bank Syariah Indonesia
  • permata => Bank Permata
  • danamon => Bank Danamon
cstore
  • indomaret
  • alfamart
cod
  • rpx
qris
  • qris

Paramaters

Parameter Request Description Type Mandatory
account VA Number numeric Y
name Customer Name string Y
email Customer E-mail string Y
phone Customer Phone numeric Y
amount Total Amount (price * qty) numeric Y
paymentMethod va, cstore, cod, qris string Y
paymentChannel "va:" bag, bca, bni, cimb, mandiri, bmi, bri, bsi, permata, danamon "cstore:" indomaret, alfamart "cod:" rpx "qris:" qris string Y
notifyUrl Return url when payment success string Y
expired Expiration in hour numeric N
description Text description string N
referenceId Shopping cart order id string N
product Product Name [array] string Y
qty Quantity [array] numeric Y
price Product Price [array] numeric Y
weight Product Weight [array] numeric Y
length Product Length [array] numeric Y
width Product Width [array] numeric Y
height Product Height [array] numeric Y
deliveryArea Postal Code Customer numeric Y
deliveryAddress Customer Address string Y
pickupArea Postal Code Shipper (Default Merchant Postal Code) numeric N
pickupAddress Shipper Address (Default Merchant Address) string N

Add Product to Cart

First, please add product to shopping cart first before using this method

$carts = [];
$carts = $iPaymu->add(
    'PROD0001', // product id (string)
    'Jacket', // product name (string)
    12000, // price (float)
    2, // quantity (int)
    'Size M', // description
    1, // product weight (int) (optional)
    1, // product length (int) (optional)
    1, // product weight (int) (optional)
    1 // product height (int) (optional)
);
$carts = $iPaymu->add(
    'PROD0002', // product id (string)
    'Shoe', // product name (string)
    150000, // price (float)
    2, // quantity (int)
    'Size 8', // description
    1, // product weight (int) (optional)
    1, // product length (int) (optional)
    1, // product weight (int) (optional)
    1 // product height (int) (optional)
);

$iPaymu->addCart($carts);

Set COD (Only if COD method)

$delivery = $iPaymu->setCOD([
        'deliveryArea' => "76111",
        'deliveryAddress' => "Denpasar",
]);

Set Expired (for custom expired)

// set your expiredPayment
$iPaymu->setExpired(24, 'hours'); // 24 hours

Set Reference ID (optional)

$iPaymu->setReferenceId('123123');

Set Payment Notes (optional)

$iPaymu->setComments('Payment TRX01');

Payment Direct

Payment direct method allows you to accept payment on your checkout page directly, this method works for any payment channel except for credit card.

Set Payment Method and Payment Channel

// set payment method
// check https://ipaymu.com/api-collection for list payment method
$iPaymu->setPaymentMethod('va');

// check https://ipaymu.com/api-collection for list payment channel
$iPaymu->setPaymentChannel('bca');
$payment = $iPaymu->directPayment();

Payment Redirect

In order accepting credit card, you must use Payment Redirect method. Upon checkout, you will be redirected to iPaymu.com payment page for further payment processing.

$payment = $iPaymu->redirectPayment();

Complete Code Example

Direct Payment Example

$apiKey = 'QbGcoO0Qds9sQFDmY0MWg1Tq.xtuh1'; // your api key
$va = '1179000899'; // your va
$production = true; // set false to sandbox mode

$iPaymu = new iPaymu($apiKey, $va, $production);

// set callback url
$iPaymu->setURL([
    'ureturn' => 'https://your-website/thankyou_page',
    'unotify' => 'https://your-website/notify_page',
    'ucancel' => 'https://your-website/cancel_page',
]);

// set buyer name
$iPaymu->setBuyer([
    'name' => 'Bagus',
    'phone' => '08123123139',
    'email' => 'bagus@gmail.com',
]);

// set your reference id (optional)
$iPaymu->setReferenceId('123123');

// set your expiredPayment
$iPaymu->setExpired(24, 'hours'); // 24 hours

// set payment method
// check https://ipaymu.com/api-collection for list payment method
$iPaymu->setPaymentMethod('va');

// check https://ipaymu.com/api-collection for list payment channel
$iPaymu->setPaymentChannel('bca');

// payment notes (optional)
$iPaymu->setComments('Payment TRX01');

$carts = [];
$carts = $iPaymu->add(
    'PROD0001', // product id (string)
    'Jacket', // product name (string)
    12000, // price (float)
    3, // quantity (int)
    'Size M', // description
    1, // product weight (int) (optional)
    1, // product length (int) (optional)
    1, // product weight (int) (optional)
    1 // product height (int) (optional)
);
$carts = $iPaymu->add(
    'PROD0002', // product id (string)
    'Shoe', // product name (string)
    150000, // price (float)
    2, // quantity (int)
    'Size 8', // description
    1, // product weight (int) (optional)
    1, // product length (int) (optional)
    1, // product weight (int) (optional)
    1 // product height (int) (optional)
);

$iPaymu->addCart($carts);

return $iPaymu->directPayment();

Redirect Payment Example

$apiKey = 'QbGcoO0Qds9sQFDmY0MWg1Tq.xtuh1'; // your api key
$va = '1179000899'; // your va
$production = true; // set false to sandbox mode

$iPaymu = new iPaymu($apiKey, $va, $production);

// set callback url
$iPaymu->setURL([
    'ureturn' => 'https://your-website/thankyou_page',
    'unotify' => 'https://your-website/notify_page',
    'ucancel' => 'https://your-website/cancel_page',
]);

// set buyer name
$iPaymu->setBuyer([
    'name' => 'Bagus',
    'phone' => '08123123139',
    'email' => 'bagus@gmail.com',
]);

// set your reference id (optional)
$iPaymu->setReferenceId('123123');

// set your expiredPayment
$iPaymu->setExpired(24, 'hours'); // 24 hours

// set cod param (optional)
$iPaymu->setCOD([
    'deliveryArea' => "76111",
    'deliveryAddress' => "Denpasar",
]);

$carts = [];
$carts = $iPaymu->add(
    'PROD0001', // product id (string)
    'Jacket', // product name (string)
    12000, // price (float)
    2, // quantity (int)
    'Size M', // description
    1, // product weight (int) (optional)
    1, // product length (int) (optional)
    1, // product weight (int) (optional)
    1 // product height (int) (optional)
);
$carts = $iPaymu->add(
    'PROD0002', // product id (string)
    'Shoe', // product name (string)
    150000, // price (float)
    2, // quantity (int)
    'Size 8', // description
    1, // product weight (int) (optional)
    1, // product length (int) (optional)
    1, // product weight (int) (optional)
    1 // product height (int) (optional)
);

$iPaymu->addCart($carts);

return $iPaymu->redirectPayment();

ipaymu/ipaymu-php-api 适用场景与选型建议

ipaymu/ipaymu-php-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 55.49k 次下载、GitHub Stars 达 16, 最近一次更新时间为 2020 年 02 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「payment gateway」 「indonesia」 「ipaymu」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 ipaymu/ipaymu-php-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 ipaymu/ipaymu-php-api 我们能提供哪些服务?
定制开发 / 二次开发

基于 ipaymu/ipaymu-php-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 55.49k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 16
  • 点击次数: 25
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 16
  • Watchers: 3
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2020-02-28