@@ -158,7 +158,7 @@ func paymentCardTextFieldDidChange(textField: PSTCKPaymentCardTextField) {
158158
159159#### Building your own form
160160
161- If you build your own payment form, you'll need to collect at least your customers' card numbers, CVC and expiration dates.
161+ If you build your own payment form, you'll need to collect at least your customers' card numbers, CVC and expiration dates.
162162
163163### Step 4: Assembling Card information into ` PSTCKCardParams `
164164
@@ -221,7 +221,13 @@ If you choose the `chargeCard` route, we charge cards you send using parameters
221221 let transactionParams = PSTCKTransactionParams.init ();
222222
223223 transactionParams.amount = 1390 ;
224- transactionParams.metadata = " {\" custom_fields\" :[{\" display_name\" :\" Via\" ,\" variable_name\" :\" via\" ,\" value\" :\" iOS\" }]}" ;
224+ do {
225+ try transactionParams.setCustomFieldValue (" iOS SDK" , displayedAs : " Paid Via" );
226+ try transactionParams.setCustomFieldValue (" Paystack hats" , displayedAs : " To Buy" );
227+ try transactionParams.setMetadataValue (" iOS SDK" , forKey : " paid_via" );
228+ } catch {
229+ print (error);
230+ }
225231 transactionParams.email = " e@ma.il" ;
226232
227233 // check https://developers.paystack.co/docs/split-payments-overview for details on how these work
@@ -232,7 +238,7 @@ If you choose the `chargeCard` route, we charge cards you send using parameters
232238 // if a reference is not supplied, we will give one
233239 // transactionParams.reference = "ChargedFromiOSSDK@"
234240
235- PSTCKAPIClient.shared ().chargeCard (cardParams, forTransaction : transactionParams, on : viewController,
241+ PSTCKAPIClient.shared ().chargeCard (cardParams, forTransaction : transactionParams, on : viewController,
236242 didEndWithError : { (error) -> Void in
237243 handleError (error)
238244 }, didRequestValidation : { (reference) -> Void in
@@ -246,11 +252,10 @@ If you choose the `chargeCard` route, we charge cards you send using parameters
246252``` Objective-C
247253- (IBAction )charge:(UIButton *)sender {
248254 // cardParams already fetched from our view or assembled by you
249-
255+
250256 PSTCKTransactionParams transactionParams = [[PSTCKTransactionParams alloc] init];
251257
252258 transactionParams.amount = 1390;
253- transactionParams.metadata = @"{\"custom_fields\":[{\"display_name\":\"Via\",\"variable_name\":\"via\",\"value\":\"iOS\"}]}";
254259 transactionParams.email = @"e@ma.il";
255260
256261 // check https://developers.paystack.co/docs/split-payments-overview for details on how these work
@@ -263,7 +268,7 @@ If you choose the `chargeCard` route, we charge cards you send using parameters
263268
264269 [[PSTCKAPIClient sharedClient] chargeCard:cardParams
265270 forTransaction:transactionParams
266- on: viewController,
271+ on: viewController,
267272 didEndWithError:^(NSError *error){
268273 [self handleError:error];
269274 }
@@ -346,7 +351,7 @@ func verifyCharge(reference: String) {
346351 print (" There was an error communicating with your payment backend." )
347352 // All we did here is log it to the output window
348353 }
349-
354+
350355 }
351356 }).resume ()
352357}
@@ -411,7 +416,7 @@ func createBackendChargeWithToken(token: PSTCKToken, amountinkobo: Int, emailAdd
411416 print (" There was an error communicating with your payment backend." )
412417 // All we did here is log it to the output window
413418 }
414-
419+
415420 }
416421 }).resume ()
417422}
@@ -420,8 +425,8 @@ func createBackendChargeWithToken(token: PSTCKToken, amountinkobo: Int, emailAdd
420425``` Objective-C
421426// ViewController.m
422427
423- - (void )createBackendChargeWithToken:(PSTCKToken *)token,
424- (NSInt *) amountinkobo,
428+ - (void )createBackendChargeWithToken:(PSTCKToken *)token,
429+ (NSInt *) amountinkobo,
425430 (NSString *) emailAddress
426431 {
427432 NSURL *url = [NSURL URLWithString:@"https://example.com/token"];
@@ -453,13 +458,13 @@ On the server, you just need to implement an endpoint that will accept the param
453458
454459### Step 6 Option 1: Implement verification on your server
455460Verify a charge by calling our REST API. An ` authorization_code ` will be returned once the card has been charged successfully. You can learn more about our API [ here] ( https://developers.paystack.co/docs/getting-started ) .
456-
461+
457462 ** Endpoint:** GET: https://api.paystack.co/transaction/verify
458-
463+
459464 ** Documentation:** https://developers.paystack.co/docs/verify-transaction
460465
461466 ** Parameters:**
462-
467+
463468 - reference - the transaction reference
464469
465470** Example**
@@ -473,17 +478,17 @@ Verify a charge by calling our REST API. An `authorization_code` will be returne
473478```
474479### Step 6 Option 2: Implement payment on your server
475480Create a charge by calling our REST API. An ` authorization_code ` will be returned once the _ single-use_ token has been charged successfully. You can learn more about our API [ here] ( https://developers.paystack.co/docs/getting-started ) .
476-
481+
477482 ** Endpoint:** POST: https://api.paystack.co/transaction/charge_token
478483
479484 ** Documentation:** https://developers.paystack.co/docs/charge-token
480485
481486 ** Parameters:**
482-
487+
483488 - token - the token you want to charge (required)
484- - reference - unique reference
489+ - reference - unique reference
485490 - email - customer's email address (required)
486- - amount - Amount in Kobo (required)
491+ - amount - Amount in Kobo (required)
487492
488493** Example**
489494
@@ -503,11 +508,11 @@ list($headers, $body, $code) = $paystack->transaction->chargeToken([
503508 'email'=>'customer@email.com',
504509 'amount'=>10000 // in kobo
505510 ]);
506-
511+
507512// check if authorization code was generated
508513if ((intval($code) === 200) && array_key_exists('status', $body) && $body['status']) {
509514 // body contains Array with data similar to result below
510- $authorization_code = $body['authorization']['authorization_code'];
515+ $authorization_code = $body['authorization']['authorization_code'];
511516 // save the authorization_code so you may charge in future
512517} else {
513518 // invalid body was returned
@@ -544,4 +549,4 @@ if ((intval($code) === 200) && array_key_exists('status', $body) && $body['statu
544549```
545550
546551### Charging Returning Customers
547- See details for charging returning customers [here](https://developers.paystack.co/docs/charging-returning-customers).
552+ See details for charging returning customers [here](https://developers.paystack.co/docs/charging-returning-customers).
0 commit comments