Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Notch Pay API client for PHP.

License

NotificationsYou must be signed in to change notification settings

laravelcm/notchpay-php

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A PHP API wrapper forNotch Pay.

Installation

You can install the package via composer:

composer require notchpay/notchpay-php

Usage

Do a redirect to the authorization URL received from calling the payments/initialize endpoint. This URL is valid for one time use, so ensure that you generate a new URL per payment.

When the payment is successful, we will call your callback URL (as setup in your dashboard or while initializing the transaction) and return the reference sent in the first step as a query parameter.

If you use a test public key, we will call your test callback url, otherwise, we'll call your live callback url.

0. Prerequisites

Confirm that your server can conclude a TLSv1.2 connection to Notch Pay's servers. Most up-to-date software have this capability. Contact your service provider for guidance if you have any SSL errors.Don't disable SSL peer verification!

1. Prepare your parameters

email,amount andcurrency are the most common compulsory parameters. Do send a unique email per customer.The amount accept numeric value value.The currency accept currency ISO 3166.For instance, to acceptFor US Dollar, please sendUSD as the currency.

2. Initialize a onetime payments

Initialize a payment by calling our API.

useNotchPay\NotchPay;useNotchPay\Payment;NotchPay::setApiKey('sk_1234abcd');try {$tranx = Payment::initialize(['amount'=>$amount,// according to currency format'email'=>$email,// unique to customers'currency'=>$currency,// currency iso code'callback'=>$callback,// optional callback url'reference'=>$reference,// unique to transactions    ]);}catch(\NotchPay\Exceptions\ApiException$e){print_r($e->errors);die($e->getMessage());}// redirect to page so User can payheader('Location:' .$tranx->authorization_url);

When the user enters their payment details, NotchPay will validate and charge the card. It will do all the below:

Send a payment.complete event to your Webhook URL set at:https://business.notchpay.co/settings/developer

If receipts are not turned off, an HTML receipt will be sent to the customer's email.

3. Verify Transaction

After we redirect to your callback, please verify the transaction before giving value.

$reference =isset($_GET['reference']) ?$_GET['reference'] :'';if(!$reference){die('No reference supplied');    }// initiate the Library's NotchPay Object    NotchPay::setApiKey('sk_1234abcd');try {$tranx = Payment::verify($reference);if ($tranx->transaction->status ==='complete') {// transaction was successful...// please check other things like whether you already gave value for this ref// if the email matches the customer who owns the product etc// Give value    }}catch(\NotchPay\Exceptions\ApiException$e){print_r($e->errors);die($e->getMessage());}

Changelog

Please seeCHANGELOG for more information on what has changed recently.

Contributing

Please seeCONTRIBUTING for details.

Security

If you discover any security related issues, please emailhello@notchpay.co instead of using the issue tracker.

License

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

About

Notch Pay API client for PHP.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP100.0%

[8]ページ先頭

©2009-2025 Movatter.jp