0.1.0-alpha.5 ⢠Published 5 years ago
express-payment-request-react-native v0.1.0-alpha.5
express-payment-request-react-native
šø The companion React Native (iOS/Android/Web) frontend for express-payment-request.
This allows you to accept cross-platform payments using services such as Apple Pay without linking.
š Getting Started
Using yarn
:
yarn add express-payment-request-react-native
āļø Example
Below, we show that a the client can define the amount to pay via the usePaymentRequest
hook. This requires that your app is wrapped within a PaymentRequestProvider.
import React from "react";
import { TouchableOpacity, Text } from "react-native";
import PaymentRequestProvider, { usePaymentRequest } from "express-payment-request-react-native";
function Button() {
const { requestPayment, clearPaymentRequest } = usePaymentRequest();
return (
<TouchableOpacity
onPress={() =>
requestPayment({
displayItems: [
{
label: "A client driven amount!",
amount: { currency: "USD", value: "0.02" },
},
],
total: {
label: "Total due",
amount: { currency: "USD", value: "0.02" },
},
})
}
>
<Text children="Request Payment of $0.02" />
</TouchableOpacity>
);
}
function App() {
return (
<PaymentRequestProvider uri="https://localhost:3000/payment">
<Button />
</PaymentRequestProvider>
);
}
āļø License
0.1.0-alpha.5
5 years ago
0.1.0-alpha.3
5 years ago
0.1.0-alpha.1
5 years ago
0.1.0-alpha.0
5 years ago
0.0.1-alpha.0
5 years ago