Almaz Ilyasov
Almaz Ilyasov

Reputation: 23

How to use Apple Pay in NativeScript

I'm trying to make Apple Pay in NativeScript app by using native code.
But have some errors with data type (?)

let item = new PKPaymentSummaryItem();
item.label = "iPhone Xs 64 Gb";
item.amount = 39999;

JavaScript error:

file:///app/components/Home.vue:24:0 JS ERROR Error: -[__NSCFNumber decimalNumberByRoundingAccordingToBehavior:]: unrecognized selector sent to instance 0xf549d0dbe6e8cc69

Upvotes: 1

Views: 225

Answers (1)

anthares
anthares

Reputation: 11223

As the error message suggests, you need to get the typing conversion right. Installing the tns-platform-declarations packages as a dev dependency to your project will give you handy intellisense which will guide you through such issues. For this particular case, try like that:

item.amount = new NSDecimalNumber({ string: "29999" });

Upvotes: 1

Related Questions