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);
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);
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);
来源:https://stackoverflow.com/questions/39122198/sirikit-payment-confirmation-currency-is-always-us