updatePlan method
Updates a plan with the CREATED or ACTIVE status. For an INACTIVE plan, you can make only status updates. You can patch these attributes and objects:
- description. Operations: replace
- payment_preferences.auto_bill_outstanding. Operations: replace
- taxes.percentage. Operations: replace
- payment_preferences.payment_failure_threshold. Operations: replace
- payment_preferences.setup_fee. Operations: replace
- payment_preferences.setup_fee_failure_action. Operations: replace
Parameter planId: The ID of the plan.
Parameter patchRequests: The list of updates.
Implementation
Future<void> updatePlan(String planId, List<Patch> patchRequests) async {
var url = _payPalHttpClient.getUrl('/v1/billing/plans/$planId');
var patchRequest = List.generate(
patchRequests.length, (index) => patchRequests[index].toJson());
var body = jsonEncode(patchRequest);
await _payPalHttpClient.patch(url, body: body);
}