Last active
November 22, 2023 08:40
-
-
Save antimech/c4a637d0316cb61b16f07e42a690959d to your computer and use it in GitHub Desktop.
Create subscriptions plans (checkout) through Coinbase Commerce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php8.1 | |
<?php | |
// $ composer require antimech/coinbase:^0.11.0 | |
require __DIR__ . '/vendor/autoload.php'; | |
$coinbase = new Coinbase; | |
// Promotion | |
$coinbase->createCheckout([ | |
'name' => 'ProductName 1M Subscription', | |
'description' => 'ProductName 1 Month Subscription', | |
'pricing_type' => 'fixed_price', | |
'local_price' => [ | |
'amount' => '200', | |
'currency' => 'USD', | |
], | |
]); | |
$coinbase->createCheckout([ | |
'name' => 'ProductName 3M Subscription', | |
'description' => 'ProductName 3 Months Subscription', | |
'pricing_type' => 'fixed_price', | |
'local_price' => [ | |
'amount' => '400', | |
'currency' => 'USD', | |
], | |
]); | |
$coinbase->createCheckout([ | |
'name' => 'ProductName 6M Subscription', | |
'description' => 'ProductName 6 Months Subscription', | |
'pricing_type' => 'fixed_price', | |
'local_price' => [ | |
'amount' => '600', | |
'currency' => 'USD', | |
], | |
]); | |
// Default | |
$coinbase->createCheckout([ | |
'name' => 'ProductName 1M Subscription', | |
'description' => 'ProductName 1 Month Subscription', | |
'pricing_type' => 'fixed_price', | |
'local_price' => [ | |
'amount' => '300', | |
'currency' => 'USD', | |
], | |
]); | |
$coinbase->createCheckout([ | |
'name' => 'ProductName 3M Subscription', | |
'description' => 'ProductName 3 Months Subscription', | |
'pricing_type' => 'fixed_price', | |
'local_price' => [ | |
'amount' => '600', | |
'currency' => 'USD', | |
], | |
]); | |
$coinbase->createCheckout([ | |
'name' => 'ProductName 6M Subscription', | |
'description' => 'ProductName 6 Months Subscription', | |
'pricing_type' => 'fixed_price', | |
'local_price' => [ | |
'amount' => '1000', | |
'currency' => 'USD', | |
], | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment