2016-09-20 3 views
0
hinzu

Ich werde sofort Zahlung API in ASP.Net MVC verwenden, aber ich habe Problem, Informationen im folgenden XML-Format in C# hinzuzufügen.So fügen Sie Informationen zum sofortigen API-XML mit C#

<?xml version="1.0" encoding="UTF-8" ?> 
<multipay>  
    <project_id>53245</project_id> 
    <interface_version>pn_test_1</interface_version> 
    <amount>2.20</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>xyz</success_url> 
    <success_link_redirect>1</success_link_redirect> 
    <abort_url>xyz</abort_url> 
    <notification_urls> 
     <notification_url>xyz</notification_url> 
     <notification_url notify_on="received,loss">xyz</notification_url> 
    </notification_urls> 
    <su /> 
</multipay> 
+0

Beschreiben Sie das genaue Problem, das Sie haben; Wenn Sie irgendwelche Fehlermeldungen veröffentlichen, wird es viel hilfreicher sein. – Jacob

Antwort

0
var xmlRequest = new XElement("multipay", 
new XElement("project_id", "53245"), 
new XElement("interface_version", "pn_test_1"), 
new XElement("amount", "2.20"), 
new XElement("currency_code", "EUR"), 
new XElement("reasons", new XElement("reason", "Testueberweisung"), new XElement("reason", "-TRANSACTION-")) 
); 

String xmlreq = xmlRequest.ToString();

+0

Großartig! Dein Code hat funktioniert. –

Verwandte Themen