Skip to content

Instantly share code, notes, and snippets.

@antimech
Last active November 22, 2023 08:40
Show Gist options
  • Save antimech/c4a637d0316cb61b16f07e42a690959d to your computer and use it in GitHub Desktop.
Save antimech/c4a637d0316cb61b16f07e42a690959d to your computer and use it in GitHub Desktop.
Create subscriptions plans (checkout) through Coinbase Commerce
#!/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