mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 14:57:26 +08:00
Create PayPal subscription plan from WC subscription product (WIP)
This commit is contained in:
parent
3c1ad831c1
commit
760a6d06f7
3 changed files with 65 additions and 3 deletions
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue