Create PayPal subscription plan from WC subscription product (WIP)

This commit is contained in:
emilicastells 2023-01-05 17:33:03 +01:00
parent 3c1ad831c1
commit 760a6d06f7
No known key found for this signature in database
GPG key ID: 1520C07081754570
3 changed files with 65 additions and 3 deletions

View file

@ -67,9 +67,9 @@ class CatalogProducts {
* @throws RuntimeException If the request fails.
* @throws PayPalApiException If the request fails.
*/
public function create(): stdClass {
public function create(string $name): stdClass {
$data = array(
'name' => '',
'name' => $name,
);
$bearer = $this->bearer->bearer();

View file

@ -70,9 +70,17 @@ class Subscriptions {
* @throws RuntimeException If the request fails.
* @throws PayPalApiException If the request fails.
*/
public function create_plan( string $product_id ): stdClass {
public function create_plan(
string $product_id,
array $billing_cycles,
array $payment_preferences
): stdClass {
$data = array(
'product_id' => $product_id,
'name' => 'Testing Plan',
'billing_cycles' => array($billing_cycles),
'payment_preferences' => $payment_preferences
);
$bearer = $this->bearer->bearer();