- Notifications
You must be signed in to change notification settings - Fork0
Notch Pay API client for PHP.
License
laravelcm/notchpay-php
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A PHP API wrapper forNotch Pay.
You can install the package via composer:
composer require notchpay/notchpay-php
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.
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!
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.
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.
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());}
Please seeCHANGELOG for more information on what has changed recently.
Please seeCONTRIBUTING for details.
If you discover any security related issues, please emailhello@notchpay.co instead of using the issue tracker.
The MIT License (MIT). Please seeLicense File for more information.
About
Notch Pay API client for PHP.
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Languages
- PHP100.0%