Skip to content

Commit

Permalink
Add reusable alipay source params.
Browse files Browse the repository at this point in the history
Alipay type already exists and is parsed and handled correctly, so adding reusable should theoretically only be a matter of adding this new helper method.
  • Loading branch information
bdorfman-stripe committed Oct 9, 2017
1 parent da8b1de commit 80ec3f8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Stripe/PublicHeaders/STPSourceParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,19 @@ NS_ASSUME_NONNULL_BEGIN
currency:(NSString *)currency
returnURL:(NSString *)returnURL;

/**
Creates params for a reusable Alipay source
@see https://stripe.com/docs/sources/alipay#create-source
@param currency The currency the payment is being created in.
@param returnURL The URL the customer should be redirected to after they have
successfully verified the payment.
@return An STPSourceParams object populated with the provided values
*/
+ (STPSourceParams *)alipayReusableParamsWithCurrency:(NSString *)currency
returnURL:(NSString *)returnURL;

/**
Creates params for a P24 source
@see https://stripe.com/docs/sources/p24#create-source
Expand Down
11 changes: 11 additions & 0 deletions Stripe/STPSourceParams.m
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,17 @@ + (STPSourceParams *)alipayParamsWithAmount:(NSUInteger)amount
return params;
}

+ (STPSourceParams *)alipayParamsWithCurrency:(NSString *)currency
returnURL:(NSString *)returnURL {
STPSourceParams *params = [self new];
params.type = STPSourceTypeAlipay;
params.currency = currency;
params.redirect = @{ @"return_url": returnURL };
params.usage = STPSourceUsageReusable;

return params;
}

+ (STPSourceParams *)p24ParamsWithAmount:(NSUInteger)amount
currency:(NSString *)currency
email:(NSString *)email
Expand Down

0 comments on commit 80ec3f8

Please sign in to comment.