サンドボックス環境を選択すると、「申し訳ありませんが、PayPal のサーバーとの通信中に問題が発生しました」という警告メッセージが表示されます。私のコードとスクリーンショットを以下に示します。
- (IBAction)pay {
// Remove our last completed payment, just for demo purposes.
self.completedPayment = nil;
PayPalPayment *payment = [[PayPalPayment alloc] init];
payment.amount = [[NSDecimalNumber alloc] initWithString:@"9.95"];
payment.currencyCode = @"USD";
payment.shortDescription = @"Hipster t-shirt";
if (!payment.processable) {
// This particular payment will always be processable. If, for
// example, the amount was negative or the shortDescription was
// empty, this payment wouldn't be processable, and you'd want
// to handle that here.
}
// Any customer identifier that you have will work here. Do NOT use a device- or
// hardware-based identifier.
NSString *customerId = @"user-11723";
// Set the environment:
// - For live charges, use PayPalEnvironmentProduction (default).
// - To use the PayPal sandbox, use PayPalEnvironmentSandbox.
// - For testing, use PayPalEnvironmentNoNetwork.
[PayPalPaymentViewController setEnvironment:self.environment];
PayPalPaymentViewController *paymentViewController = [[PayPalPaymentViewController alloc] initWithClientId:kPayPalClientId receiverEmail:kPayPalReceiverEmail
payerId:customerId
payment:payment
delegate:self];
paymentViewController.hideCreditCardButton = !self.acceptCreditCards;
[self presentViewController:paymentViewController animated:YES completion:nil];
}