Skip to content

Commit 873bba0

Browse files
author
serverpod_cloud
committed
fix: f2d733a4a2f9cdd59b78d55dc7b78dbfb026da3c
1 parent 1a2de03 commit 873bba0

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

ground_control_client/lib/src/protocol/client.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,24 @@ class EndpointBilling extends _i1.EndpointRef {
409409
'listPaymentMethods',
410410
{},
411411
);
412+
413+
/// Removes a payment method for the authenticated user.
414+
///
415+
/// This endpoint removes a payment method from the user's payment customer.
416+
/// The endpoint validates that:
417+
/// - The payment method belongs to the user
418+
/// - If payment method is required (user has active projects), the user must
419+
/// have at least one other payment method
420+
///
421+
/// [paymentMethodId] The ID of the payment method to remove.
422+
///
423+
/// Throws [NotFoundException] if the user is not found or has no payment customer.
424+
/// Throws [InvalidValueServerException] if the payment method doesn't belong to the user.
425+
/// Throws [InvalidValueServerException] if payment method is required and this is the last payment method.
426+
_i2.Future<void> removePaymentMethod({required String paymentMethodId}) =>
427+
caller.callServerEndpoint<void>('billing', 'removePaymentMethod', {
428+
'paymentMethodId': paymentMethodId,
429+
});
412430
}
413431

414432
/// {@category Endpoint}

0 commit comments

Comments
 (0)