jeudi 30 juin 2016

iOS Swift PayPal Always In Sandbox


I have successfully integrated PayPal into my app. However, it seems to be stuck in Sandbox mode. Here is my code to initialize it:

PayPalMobile .initializeWithClientIdsForEnvironments([PayPalEnvironmentProduction: "APP-0XU423690N0796541"])

As can been seen, I'm not even specifying a sandbox ID.

My code to initiate the payment is:

let payPalConfig = PayPalConfiguration()

        payPalConfig.merchantName = "MacCrafters Software"

        let item1 = PayPalItem(name: "Donation", withQuantity: 1, withPrice: NSDecimalNumber(string: amountField.text!), withCurrency: "USD", withSku: "Donation")

        let items = [item1]
        let subtotal = PayPalItem.totalPriceForItems(items)

        // Optional: include payment details
        let shipping = NSDecimalNumber(string: "0.00")
        let tax = NSDecimalNumber(string: "0.00")
        let paymentDetails = PayPalPaymentDetails(subtotal: subtotal, withShipping: shipping, withTax: tax)

        let total = subtotal.decimalNumberByAdding(shipping).decimalNumberByAdding(tax)

        let payment = PayPalPayment(amount: total, currencyCode: "USD", shortDescription: "Donation", intent: .Sale)

        payment.items = items
        payment.paymentDetails = paymentDetails

        if (payment.processable) {
            let paymentViewController = PayPalPaymentViewController(payment: payment, configuration: payPalConfig, delegate: self)
            presentViewController(paymentViewController!, animated: true, completion: nil)
        }

At the bottom of the PayPal view it always says "Mock Data". I get the same results no matter if I'm in the simulator or on a device. What am I doing wrong?


Aucun commentaire:

Enregistrer un commentaire