SiriKit 付款确认货币始终为美元

SiriKit payment confirmation currency is always US$

我构建了 Intents Extension,我正在处理 INSendMoneyIntent,我说:

Send 25€ to John Smith

应用确认后的响应

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

Intent 包含正确的货币 iso 3 代码 - 欧元,那么为什么 siri 在付款确认中显示错误的货币?

回归意图

INSendPaymentIntentResponse *reponse = [[INSendPaymentIntentResponse alloc] initWithCode:INSendPaymentIntentResponseCodeReady userActivity:userActivity];
completion(reponse);

您需要在

中的回复中添加付款记录

(void)confirmSendPayment:(INSendPaymentIntent *)intent

像这样:

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);

同意 Julius 的回答,但没有说明在哪里设置货币。您可以创建一个方法

- (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;

}

然后从委托方法中,您只需将 paymentrecord 赋值放在上述两个语句之间:

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

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

    completion(response);