-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRedirectCheckoutExample.java
More file actions
40 lines (34 loc) · 1.47 KB
/
RedirectCheckoutExample.java
File metadata and controls
40 lines (34 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import com.paydunya.neptune.*;
public class RedirectCheckoutExample {
public static void main(String args[]) throws Exception {
// Setup your API keys and mode
PaydunyaSetup apiSetup = new PaydunyaSetup();
apiSetup.setMasterKey("wQzk9ZwR-Qq9m-0hD0-zpud-je5coGC3FHKW");
apiSetup.setPrivateKey("test_private_rMIdJM3PLLhLjyArx9tF3VURAF5");
apiSetup.setPublicKey("test_public_kb9Wo0Qpn8vNWMvMZOwwpvuTUja");
apiSetup.setToken("IivOiOxGJuWhc5znlIiK");
apiSetup.setMode("test");
// Setup your store information
PaydunyaCheckoutStore storeSetup = new PaydunyaCheckoutStore();
storeSetup.setName("Magasin Chez Sandra");
storeSetup.setTagline("L'élégance n'a pas de prix.");
storeSetup.setPhoneNumber("336530583");
storeSetup.setPostalAddress("Dakar Plateau - Etablissement kheweul");
storeSetup.setWebsiteUrl("http://www.chez-sandra.sn");
// Start creating an Paydunya Checkout
PaydunyaCheckoutInvoice co = new PaydunyaCheckoutInvoice(apiSetup, storeSetup);
// Add invoice items
co.addItem("Clavier DELL",2,3000,6000);
co.addItem("Ordinateur Lenovo L440",1,400000,400000);
co.addItem("Casque Logitech",1,8000,8000);
// You will need to calculated the total amout yourself.
co.setTotalAmount(414000);
// Create the invoice
if (co.create()) {
System.out.println("Invoice URL: "+co.getInvoiceUrl());
}else{
System.out.println("Error Occured: "+ co.getResponseCode());
System.out.println(co.getResponseText());
}
}
}