1. Go to this page and download the library: Download youcanpay/payment-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
youcanpay / payment-sdk example snippets
use YouCan\Pay\YouCanPay;
class ExamplePayment
{
/**
* Return a token to make payment for an order, this token is line.
YouCanPay::setIsSandboxMode(true);
// Create a YouCan Pay instance, to retrieve your private and public keys login to your YouCan Pay account
// and go to Settings and open API Keys.
$youCanPay = YouCanPay::instance()->useKeys('my-private-key', 'my-public-key');
// Data of the customer who wishes to make this purchase.
// Please keep these keys.
$customerInfo = [
'name' => '',
'address' => '',
'zip_code' => '',
'city' => '',
'state' => '',
'country_code' => '',
'phone' => '',
'email' => '',
];
// You can use it to send data to retrieve after the response or in the webhook.
$metadata = [
// Can you insert what you want here...
//'key' => 'value'
];
// Create the order you want to be paid
$token = $youCanPay->token->create(
// String orderId (
use YouCan\Pay\YouCanPay;
class ExamplePayment
{
/**
* Return a URL to make payment for an order.
*
* @return string
*/
public function createPaymentURL()
{
// Enable sandbox mode, otherwise delete this line.
YouCanPay::setIsSandboxMode(true);
// Create a YouCan Pay instance, to retrieve your private and public keys login to your YouCan Pay account
// and go to Settings and open API Keys.
$youCanPay = YouCanPay::instance()->useKeys('my-private-key', 'my-public-key');
// Data of the customer who wishes to make this purchase.
// Please keep these keys.
$customerInfo = [
'name' => '',
'address' => '',
'zip_code' => '',
'city' => '',
'state' => '',
'country_code' => '',
'phone' => '',
'email' => '',
];
// You can use it to send data to retrieve after the response or in the webhook.
$metadata = [
// Can you insert what you want here...
//'key' => 'value'
];
// Create the order you want to be paid
$token = $youCanPay->token->create(
// String orderId (
html
<a href=" createPaymentURL();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.