PHP code example of cloudswipe / cloudswipe-wp
1. Go to this page and download the library: Download cloudswipe/cloudswipe-wp 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/ */
cloudswipe / cloudswipe-wp example snippets
CloudSwipe_Wp::set_secret_key( "sk_store_12345" );
// bare minimum invoice
$invoice = CloudSwipe_Wp_Invoice::create([
"description" => "T-Shirt",
"total" => 1995,
"currency" => "USD"
]);
// more detailed invoice
$invoice = CloudSwipe_Wp_Invoice::create([
"total" => 2705,
"currency" => "USD",
"customer" => [
"name" => "Bud Abbott",
"email" => "[email protected] "
"billing_address" => [
"name" => "Bud Abbott",
"company" => "Laugh Lines",
"line1" => "123 Anystreet",
"line2" => "Suite A",
"city" => "Anytown",
"state" => "VA",
"zip" => "12345",
"country" => "US",
"phone" => "111-222-3333"
],
"shipping_address" => [
"name" => "Lou Costello",
"company" => "Laugh Lines",
"line1" => "456 Otherstreet",
"line2" => "Suite Z",
"city" => "Othertown",
"state" => "VA",
"zip" => "12345",
"country" => "US",
"phone" => "111-222-3333"
],
"line_items" => [
"header" => ["Item", "Description", "Quantity", "Total"],
"rows" => [
["T-Shirt", "Small, Blue", 1, 1095],
["Mug", "Branded Coffee Mug", 2, 535]
]
],
"line_totals" => [
"rows" => [
["Discount" => 500],
["Tax" => 245],
["Shipping" => 795]
]
],
"metadata" => [
"some-custom-field" => "some-custom-value"
]
]
]);
$invoice = CloudSwipe_Wp_Invoice::get_one( "in_12345" );
$invoices = CloudSwipe_Wp_Invoice::get_all();