Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Source sourceCreate;
- try {
- Map<String, Object> sourceParams = new HashMap<String, Object>();
- sourceParams.put("type", "klarna");
- sourceParams.put("amount", 500);
- sourceParams.put("currency", "gbp");
- Map<String, Object> klarnaParams = new HashMap<String, Object>();
- klarnaParams.put("product","payment");
- klarnaParams.put("purchase_country","GB");
- sourceParams.put("klarna", klarnaParams);
- /*
- Source.OrderItem item = new Source.OrderItem();
- item.setAmount((long) 500);
- item.setType("sku");
- item.setCurrency("gbp");
- */
- Map<String, Object> orderItem = new HashMap<String, Object>();
- orderItem.put("amount", 500);
- orderItem.put("type", "sku");
- orderItem.put("currency", "gbp");
- ArrayList<Object> items = new ArrayList<Object>();
- items.add(orderItem);
- Map<String, Object> orderParams = new HashMap<String, Object>();
- orderParams.put("items", items);
- sourceParams.put("source_order", orderParams);
- sourceCreate = Source.create(sourceParams);
- } catch (StripeException err) {
- System.out.println("Error :" + err.toString() + err.getCode());
- responseObject.setError(err.toString());
- } catch (Exception ex) {
- System.out.println("Error : " + ex.toString());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement