Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var username = '123',
- password = '123',
- url = 'https://' + username + ':' + password + '@api.sofort.com/api/xml';
- request({url: url}, function (error, respa, body) { // Im endeffekt muss ich im selben Schritt auch noch den XML string
- // der drunter zu finden ist da iwie mit rein bekommen
- // Do more stuff with 'body' here
- if (error) throw error;
- console.log(respa);
- console.log(body);
- });
- var success_url = "url";
- var abort_url = "url";
- var notification_url = "url";
- var amount = 0;
- if(product === "wochenplan"){
- amount = "9.90";
- }else if(product === "basic"){
- amount = "14.90";
- }else{
- amount = "19.90";
- }
- var XML = '<?xml version="1.0" encoding="UTF-8" ?>'+
- '<multipay>'+
- '<project_id>1</project_id>'+
- '<interface_version>pn_test_1</interface_version>'+
- '<amount>'+amount+'</amount>'+
- '<currency_code>EUR</currency_code>'+
- '<reasons>'+
- '<reason>Testueberweisung</reason>'+
- '<reason>-TRANSACTION-</reason>'+
- '</reasons>'+
- '<user_variables>'+
- '<user_variable>test</user_variable>'+
- '</user_variables>'+
- '<success_url>'+success_url+'</success_url>'+
- '<success_link_redirect>1</success_link_redirect>'+
- '<abort_url>'+abort_url+'</abort_url>'+
- '<notification_emails>'+
- '<notification_email>office@snoutnet.com</notification_email>'+
- '</notification_emails>'+
- '<su />'+
- '</multipay>';
- request({
- url: "https://api.sofort.com/api/xml",
- method: "POST",
- headers: {
- "content-type": "application/xml",
- },
- body: XML
- }, function (error, resp, body){
- console.log(body);
- // response.send(resp);
- });
- }else{
- console.log("Exiting with due to wrong product.");
- response.send("error");
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement