承接 ravols/everifin-sdk-php 相关项目开发

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

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

ravols/everifin-sdk-php

最新稳定版本:0.2.1

Composer 安装命令:

composer require ravols/everifin-sdk-php

包简介

PHP sdk for Everifin payment gateway.

README 文档

README

image image

This package is a clean SDK for PHP implementation of Everifin Payment Gateway. By using this package you can create new payments, redirects to gateway and process payments in no time.

Installation

You can install the package via composer:

composer require ravols/everifin-sdk-php

Usage

There are multiple modules each representing a domain of services that everifin provides. Let's say you want the most wanted things, which is to create a new order and get a redirect url which will take your customer to Everifin payment gateway, so that you customer can pay for your order.

First of all we need to setup a Config object.

Config::getInstance()->setClientId('your-client-id')->setClientSecret('your-client-secret')->setClientIban('your-recipient-iban');

This config needs to be setup only once, as it is accessible as a singleton throughout your application lifecycle.

Lets create new everifin order in order to get our payment redirect url.

$everifinOrderModule = new EverifinOrders; //Represents Everifin Order domain

$createOrderRequest = new CreatePaymentRequest(
    instructionId: '',//if not filled, auto generated by everifin
    amount: 120.99, //float or int
    currency: 'EUR', //Need to be standard currency code
    redirectUrl: 'your-redirect-url', //where customer will land after payment / cancelling the payment on everifin
    recipientIban: Config::getInstance()->getClientIban(),
    senderBankId: 'fkbaredn',
    recipientBankBic: 'uncrskbx',
    variableSymbol: 'variable-symbol', //order number for example, there is a lenght limitation though
    constantSymbol: '0308',
    specificSymbol: '0000000003',
    paymentMessage: 'message-if-you-want',
    externalId: 'ext4123',
    senderEmail:'customer-email',
);

//This response data contain much more than just the link, for this example we are just interested in the redirect link
$createOrderPaymentResponseData = $everifinOrderModule->createOrderPaymentResponse(createPaymentRequest:$createOrderRequest);

$url = $createOrderPaymentResponseData->link;
//Your logic follows with the link - redirect, send via email etc.

Great! So now we have our link and let's simulate that we want to process this payment once your customer pays or cancels the payment.

//Depending how you build your Config class you may or may not build it again, for this example we start from scratch
Config::getInstance()->setClientId('your-client-id')->setClientSecret('your-client-secret')->setClientIban('your-recipient-iban');

//Lets get details about the payment
$everifinPayment = new EverifinPayments;

//The order id is send to you as a request GET paramter to the redirect url specified in the redirectUrl parameter when creating an order
$responseData = $everifinPayment->getPayment(paymentId: 'f459c0b7-949e-4266-854d-8f451d5e3c68'); //returns GetPaymentResponse object

$statusOfPayment = $responseData->status; //BOOKED, or other status which can be found in the official everifin docs
//Your logic depending on the status follows here - process order, cancel order etc.

List of statuses and more information about everifin API can be found in their documentation

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

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