Integrate Paydify crypto payment gateway into DroidScript games and apps. Create payment sessions, display QR codes, poll for confirmations, and handle webhooks.
Complete Paydify payment integration for DroidScript applications.
// Load the library
var PaydifyPayments = require("./lib/PaydifyPayments.js");
// Initialize
var paydify = new PaydifyPayments({
apiKey: "your-api-key",
merchantId: "your-merchant-id",
currency: "BTC",
environment: "sandbox" // or "production"
});
// Create payment
paydify.createPayment({
amount: 0.001,
description: "Chronospace Explorer Full Version",
orderId: "ORDER-" + Date.now()
}, function(paymentData, error) {
if (error) {
app.ShowPopup("Payment failed: " + error.message);
return;
}
// Display payment UI
paydify.displayPaymentUI(paymentData, {
layout: gameLayout,
onSuccess: function(data) {
app.ShowPopup("Payment confirmed!");
unlockFullGame();
},
onFailure: function(data) {
app.ShowPopup("Payment failed or expired");
}
});
});
new PaydifyPayments(config)
| Parameter | Type | Required | Description |
|---|---|---|---|
| apiKey | string | Yes | Your Paydify API key |
| merchantId | string | Yes | Your merchant ID |
| currency | string | No | Default currency (BTC, ETH, etc.) |
| environment | string | No | "sandbox" or "production" |
Create a new payment request.
| Option | Type | Description |
|---|---|---|
| amount | number | Amount to charge |
| currency | string | Crypto currency |
| description | string | Payment description |
| orderId | string | Your internal order ID |
| callbackUrl | string | Webhook URL for notifications |
| metadata | object | Additional data |
Display payment QR code and status in your app.
| uiConfig | Type | Description |
|---|---|---|
| layout | Layout | Parent layout (optional) |
| onSuccess | function | Called on payment confirmation |
| onFailure | function | Called on failure/expiry |
Poll for payment status updates.
Verify webhook signature for payment notifications.
Retrieve past payments.
games/ChronospaceExplorer/lib/PaydifyPayments.js
See examples/paydify-integration.js for complete implementation.