1. Go to this page and download the library: Download jlinn/stripe-api-php 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/ */
jlinn / stripe-api-php example snippets
use Stripe\Stripe;
$stripe = new Stripe("your_api_key");
// create a charge
$request = $stripe->charges->createChargeRequest(350, "usd")->setCustomer($customer->getId());
$stripe->charges->createCharge($request);
//Without a Customer
$card Request = new CreateCardRequest($number, $expMonth, $expYear, $cvc);
$request = $stripe->charges->createChargeRequest(350, "usd")->setCard($card);
$stripe->charges->createCharge($request);
// retrieve a charge
$charge = $stripe->charges->getCharge("charge_id");
use Stripe\Request\Cards\CreateCardRequest;
// create a customer
$request = $stripe->customers->createCustomerRequest();
$request->setEmail("[email protected]")->setDescription("A customer!");
$request->setCard(new CreateCardRequest("4242424242424242", 1, 2020));
$customer = $stripe->customers->createCustomer($request);
// get the newly-created customer's id
$customerId = $customer->getId();
// retrieve a customer
$customer = $stripe->customers()->getCustomer("customer_id");
bash
$ php composer.phar
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.