Refund
This API can be used to undo the purchase API's action a purchase action. The API is a restrictive one and can be called by an admin of the site only. Any other user trying to invoke this API would result in an error being returned by the API.
Upon calling this API
- The Invoice of original transaction will be put in REFUNDED status
- If the original invoice was related to single purchase, then that purchase will be undone. E.g. if it was for program-session or course-session enrollment, then user will be removed from the corresponding program / course-session.
- If the original invoice was related to group purchase, then the coupon resulted from original transaction will be put in REFUNDED status and any user enrolled in course-session or program using that coupon will be removed.
API Details
Signature of API call
connection.invokeApi(String uri, String realUserName, Map<String, String> requestParameters);
See details about invoking API in general
Parameter 1 - URI
paymentTxnService.do
Parameter 2 - UserName
Username of any site administrator
Parameter 3 - Request Parameters
Name | Value |
dispatch | refund |
id | Invoice id of original purchase transaction |
Response
1. Response on successful refund
HTTP Response Code = HttpServletResponse.SC_OK
Response XML
<response code="0">
<msgs>
<msg>
<code>0</code>
<value>
<![CDATA[Success]]>
</value>
</msg>
</msgs>
</response>
2. Response for unauthorized access
HTTP Response Code = HttpServletResponse.SC_UNAUTHORIZED
Response XML
<response code="-1">
<msgs>
<msg>
<code>0005</code>
<value><![CDATA[You are not allowed to perform this action.]]></value>
</msg>
</msgs>
</response>
Error response when invoice not found
<response code="-1">
<msgs>
<msg>
<code>0004</code>
<value><![CDATA[Unable to find Invoice with matching Id xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx.]]></value>
</msg>
</msgs>
</response>
Error response when invoice is not in refundable state (already refunded)
<response code="-1">
<msgs>
<msg>
<code>0231</code>
<value><![CDATA[Not refundable Invoice 34669703-f5b3-11e7-a6ac-0cc47a352510, status = REFUNDED]]></value>
</msg>
</msgs>
</response>
Code Snippet
/* Check API Call for detail generic code */
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("dispatch", "refund");
String retStr = connection.invokeApi("paymentTxnService.do", "chenry", parameters);
System.out.println(retStr);
Example of group purchase
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("dispatch", "refund");
parameters.put("id", "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx");
String retStr = connection.invokeApi("paymentTxnService.do", "chenry", parameters);
Related Pages
Group Management
Javascript
- Customization On Payment Page
- Validate IP Address while accessing the course
- UI Customization JavaScript Functions
- Verify Custom properties during Test Taking
- Verifying User Properties During Test
- JS Example
- example_custom_scripts
- Test Taking - Customization using callback mechanism
- Cms Calendar Example
Reports
Enrollment Management
- API - Update Event Subscription
- API - Create ExamTestInstance
- Update Program Member - via Program Session Id
- Update Program Member
- API - Self Enroll in Course Session
- Update Course Session Member
- API - Self Enroll in Program Session
- API - Self Enroll in Event
- API - Enroll Users in Course Session
- API - Enroll Users in Program Session
- API - Enroll Users in Event
- API - Enroll Users in Program
Other
Introduction
Report
- Get Sites Metadata
- Get Open Learning Items List
- API - Program Enrollment Summary
- API - Course Enrollment Summary
- Get Catalog Items List
- API - Course Session Members list
- API - Program Members List
- Event participants list
- Api - Test Attempts (Test Instances) List
- Test instance details list
- Api - Non Subscribed Event List
- Api - Subscribed Event List
- API - List All Report Schedules
- API - Get Latest Report Content For A Given Schedule ID
- API - Get Report Content For A Given Report ID
- API - List Reports For A Given Schedule
User Management
- API - User list
- API - Get user details
- Api - User Creation
- API - Create User (With Custom Properties)
- API - Update User
- API - Rename User
- API - Add user to group(s)
- API - Remove user from group(s)
- Merge User Accounts
- API - Activate User
- API - Deactivate User
- API - Change User's Origin Site
- Api - User Login (Creating User Session)
eCommerce
API Documentation
Examples
- User Creation
- User Update
- User List
- Get User Details
- Add User to Group(s)
- Remove User from Group(s)
- User Activate
- User Deactivate
- User Login
- Group List
- Group Membership
- Course Subscription(Coupon Code)
- Subscribed Events List
- Non Subscribed Events List
- Test Instances in Microsite
- Forum APIs
- Javascript Example
Client Example
Quick Links
- Home
- Getting Started
- Knowledgebase
- Video Tutorials
- Google Apps Integration
- Gilly (Plugin for Atlassian Confluence)
Group Management
Javascript
- Customization On Payment Page
- Validate IP Address while accessing the course
- UI Customization JavaScript Functions
- Verify Custom properties during Test Taking
- Verifying User Properties During Test
- JS Example
- example_custom_scripts
- Test Taking - Customization using callback mechanism
- Cms Calendar Example
Reports
Enrollment Management
- API - Update Event Subscription
- API - Create ExamTestInstance
- Update Program Member - via Program Session Id
- Update Program Member
- API - Self Enroll in Course Session
- Update Course Session Member
- API - Self Enroll in Program Session
- API - Self Enroll in Event
- API - Enroll Users in Course Session
- API - Enroll Users in Program Session
- API - Enroll Users in Event
- API - Enroll Users in Program
Other
Introduction
Report
- Get Sites Metadata
- Get Open Learning Items List
- API - Program Enrollment Summary
- API - Course Enrollment Summary
- Get Catalog Items List
- API - Course Session Members list
- API - Program Members List
- Event participants list
- Api - Test Attempts (Test Instances) List
- Test instance details list
- Api - Non Subscribed Event List
- Api - Subscribed Event List
- API - List All Report Schedules
- API - Get Latest Report Content For A Given Schedule ID
- API - Get Report Content For A Given Report ID
- API - List Reports For A Given Schedule
User Management
- API - User list
- API - Get user details
- Api - User Creation
- API - Create User (With Custom Properties)
- API - Update User
- API - Rename User
- API - Add user to group(s)
- API - Remove user from group(s)
- Merge User Accounts
- API - Activate User
- API - Deactivate User
- API - Change User's Origin Site
- Api - User Login (Creating User Session)
eCommerce
API Documentation
Examples
- User Creation
- User Update
- User List
- Get User Details
- Add User to Group(s)
- Remove User from Group(s)
- User Activate
- User Deactivate
- User Login
- Group List
- Group Membership
- Course Subscription(Coupon Code)
- Subscribed Events List
- Non Subscribed Events List
- Test Instances in Microsite
- Forum APIs
- Javascript Example
Client Example
Quick Links
- Home
- Getting Started
- Knowledgebase
- Video Tutorials
- Google Apps Integration
- Gilly (Plugin for Atlassian Confluence)