Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save jonatasmaxi/c9158151bcbc1b39af7af791df20d033 to your computer and use it in GitHub Desktop.

Select an option

Save jonatasmaxi/c9158151bcbc1b39af7af791df20d033 to your computer and use it in GitHub Desktop.
Refund With Split C#
PagarMeService.DefaultApiKey = "SUA_API_KEY"
PagarMeService.DefaultEncryptionKey = "ENCRYPTION_KEY";
var account = PagarMeService.GetDefaultService().BankAccounts.Find("ID_DA_CONTA");
var transaction = PagarMeService.GetDefaultService().Transactions.Find("ID_DA_TRANSACAO");
var splitRules = new SplitRule[]{
new SplitRule
{
Id = transaction.SplitRules[0].Id,
Amount = 200,
RecipientId = transaction.SplitRules[0].RecipientId,
ChargeProcessingFee = true
},
new SplitRule
{
Id = transaction.SplitRules[1].Id,
Amount = 200,
RecipientId = transaction.SplitRules[1].RecipientId,
ChargeProcessingFee = true
}
};
try {
transaction.Refund(400, splitRules,account);
//Chamada caso cartao
//transaction.Refund(400, splitRules);
} catch(PagarMeException ex){
Console.WriteLine(ex.Error.Errors[0].Message);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment