const creditCardPayment = {
name: "Test User",
number: "4111111111111111",
expiration: "10/25",
cvv: "123",
email: "test.user@email.com",
phoneNumber: "1234567890",
address: "10 Unknown Street",
city: "Far Town",
state: "NA",
postalCode: "123456",
country: "US",
amount: 10.50,
unit: "USD",
originDomain: "example.com",
referenceId: "123-GA-456",
notifyUrl: "https://notify.me",
successUrl: "https://success.payment.com",
failureUrl: "http://fail.payment.com",
browserInfo: {
browserAcceptHeader: navigator.userAgent,
browserColorDepth: screen.colorDepth.toString(),
browserIP: "127.0.0.1", // Get from server
browserJavaEnabled: navigator.javaEnabled(),
browserJavascriptEnabled: true,
browserLanguage: navigator.language,
browserScreenHeight: screen.height.toString(),
browserScreenWidth: screen.width.toString(),
browserTZ: new Date().getTimezoneOffset().toString(),
browserUserAgent: navigator.userAgent
}
};
// Send payment request
const response = await fetch('https://your-h2h-endpoint.com', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'your-api-key'
},
body: JSON.stringify(creditCardPayment)
});