Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SiriKit payment confirmation currency is always US$

I build Intents Extension and I'm handling INSendMoneyIntent and I'm saying:

Send 25€ to John Smith

response after app confrimation

Here's your <Your_App> payment for US$25.00. Do you want to send it?

Intent contains proper currency iso 3 code - EUR, so why siri displays wrong currency in payment confirmation?

returning intent

INSendPaymentIntentResponse *reponse = [[INSendPaymentIntentResponse alloc] initWithCode:INSendPaymentIntentResponseCodeReady userActivity:userActivity];
completion(reponse);
like image 391
user3292998 Avatar asked Aug 24 '16 11:08

user3292998


2 Answers

You need to add a paymentRecord to your response in

(void)confirmSendPayment:(INSendPaymentIntent *)intent

like so:

INSendPaymentIntentResponse *response = [[INSendPaymentIntentResponse alloc] initWithCode:INSendPaymentIntentResponseCodeReady userActivity:userActivity];
response.paymentRecord = [[INPaymentRecord alloc] initWithPayee:intent.payee payer:nil currencyAmount:intent.currencyAmount paymentMethod:nil note:intent.note status:INPaymentStatusPending];
completion(response);
like image 109
julius Avatar answered Nov 20 '22 08:11

julius


Agree with Julius' answer but it doesn't show where to set the currency. You can create a method

- (INPaymentRecord *) getPaymentRecord:(INSendPaymentIntent *)intent
{
    INCurrencyAmount *currAmount = [[INCurrencyAmount alloc] initWithAmount: intent.currencyAmount currencyCode:@"ZAR"];
    INPaymentMethod *paymentMethod = [[INPaymentMethod alloc] initWithType:INPaymentMethodTypeCredit name:@"" identificationHint:@"" icon:nil];
    INPaymentRecord *paymentRecord = [[INPaymentRecord alloc] initWithPayee:nil payer:nil currencyAmount: intent.currencyAmount paymentMethod:paymentMethod note:nil status:INPaymentStatusCompleted ];
return paymentRecord;

}

And then from the delegate method you just slot the paymentrecord assignment between your above two statements:

    INSendPaymentIntentResponse *response = [[INSendPaymentIntentResponse alloc] initWithCode:INSendPaymentIntentResponseCodeSuccess userActivity:nil];

    **response.paymentRecord = [self getPaymentRecord:intent];**

    completion(response);
like image 30
ildsarria Avatar answered Nov 20 '22 10:11

ildsarria